Convert to rspec-puppet-facts

Change-Id: I780200a2520a87c8a6556cf57313ce11e29aabc3
This commit is contained in:
Tobias Urdin 2018-11-28 17:43:42 +01:00
parent 94347e2ac1
commit b48763cd7e
75 changed files with 3116 additions and 3748 deletions

View File

@ -19,19 +19,20 @@ require 'spec_helper'
describe 'neutron::agents::bagpipe' do
let :params do
{ :my_as => 64512,
:api_port => 8082,
:dataplane_driver_ipvpn => 'ovs',
:enabled => true,
:enable_rtc => true,
:manage_service => true,
:mpls_interface => '*gre*',
:ovs_bridge => 'br-mpls',
:package_ensure => 'present',
:peers => '192.168.0.101',
:proxy_arp => false,
:purge_config => false,
:local_address => '127.0.0.1'
{
:my_as => 64512,
:api_port => 8082,
:dataplane_driver_ipvpn => 'ovs',
:enabled => true,
:enable_rtc => true,
:manage_service => true,
:mpls_interface => '*gre*',
:ovs_bridge => 'br-mpls',
:package_ensure => 'present',
:peers => '192.168.0.101',
:proxy_arp => false,
:purge_config => false,
:local_address => '127.0.0.1'
}
end
@ -39,43 +40,38 @@ describe 'neutron::agents::bagpipe' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron bgpvpn bagpipe agent' do
shared_examples 'neutron bgpvpn bagpipe agent' do
let :p do
default_params.merge(params)
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_bgpvpn_bagpipe_config').with({
should contain_resources('neutron_bgpvpn_bagpipe_config').with({
:purge => false
})
end
it 'installs bgpvpn bagpipe package' do
is_expected.to contain_package('openstack-bagpipe-bgp').with(
should contain_package('openstack-bagpipe-bgp').with(
:ensure => p[:package_ensure],
:name => platform_params[:bagpipe_bgp_package],
)
end
it 'configures bgp.conf' do
is_expected.to contain_neutron_bgpvpn_bagpipe_config('api/port').with_value(p[:api_port])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('bgp/local_address').with_value(p[:local_address])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('bgp/peers').with_value(p[:peers])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('bgp/my_as').with_value(p[:my_as])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('bgp/enable_rtc').with_value(p[:enable_rtc])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/dataplane_driver').with_value(p[:dataplane_driver_ipvpn])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/ovs_bridge').with_value(p[:ovs_bridge])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/proxy_arp').with_value(p[:proxy_arp])
is_expected.to contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/mpls_interface').with_value(p[:mpls_interface])
should contain_neutron_bgpvpn_bagpipe_config('api/port').with_value(p[:api_port])
should contain_neutron_bgpvpn_bagpipe_config('bgp/local_address').with_value(p[:local_address])
should contain_neutron_bgpvpn_bagpipe_config('bgp/peers').with_value(p[:peers])
should contain_neutron_bgpvpn_bagpipe_config('bgp/my_as').with_value(p[:my_as])
should contain_neutron_bgpvpn_bagpipe_config('bgp/enable_rtc').with_value(p[:enable_rtc])
should contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/dataplane_driver').with_value(p[:dataplane_driver_ipvpn])
should contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/ovs_bridge').with_value(p[:ovs_bridge])
should contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/proxy_arp').with_value(p[:proxy_arp])
should contain_neutron_bgpvpn_bagpipe_config('dataplane_driver_ipvpn/mpls_interface').with_value(p[:mpls_interface])
end
it 'bagpipe service running' do
is_expected.to contain_service('bagpipe-bgp').with_ensure('running')
should contain_service('bagpipe-bgp').with_ensure('running')
end
context 'with multiple peers' do
@ -86,7 +82,7 @@ describe 'neutron::agents::bagpipe' do
end
it 'configures multiple peers in bgp.conf' do
is_expected.to contain_neutron_bgpvpn_bagpipe_config(
should contain_neutron_bgpvpn_bagpipe_config(
'bgp/peers'
).with_value(p[:peers].join(','))
end
@ -110,7 +106,7 @@ describe 'neutron::agents::bagpipe' do
end
end
it_configures 'neutron bgpvpn bagpipe agent'
it_behaves_like 'neutron bgpvpn bagpipe agent'
end
end
end

View File

@ -17,7 +17,6 @@
require 'spec_helper'
describe 'neutron::agents::bgp_dragent' do
let :default_params do
{
:package_ensure => 'present',
@ -29,8 +28,7 @@ describe 'neutron::agents::bgp_dragent' do
end
let :params do
{
}
{}
end
shared_examples 'neutron::agents::bgp_dragent' do

View File

@ -1,114 +1,89 @@
require 'spec_helper'
describe 'neutron::agents::bigswitch' do
let :pre_condition do
"class { 'neutron': }"
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
:package_ensure => 'present',
}
end
shared_examples 'neutron::agents::bigswitch' do
context 'neutron bigswitch base' do
it 'should have' do
should contain_package('python-networking-bigswitch').with(
:ensure => 'present',
:tag => 'openstack'
)
end
end
shared_examples_for 'neutron bigswitch base' do
it 'should have' do
is_expected.to contain_package('python-networking-bigswitch').with(
:ensure => 'present',
:tag => 'openstack'
)
context 'neutron-bsn-agent only' do
let :params do
{
:lldp_enabled => false,
:agent_enabled => true
}
end
it 'enable neutron-bsn-agent service' do
should contain_service('bigswitch-agent').with(
:enable => params[:agent_enabled],
:ensure =>'running',
:tag =>'neutron-service',
)
end
it 'disable neutron-bsn-lldp service' do
should contain_service('bigswitch-lldp').with(
:enable => params[:lldp_enabled],
:ensure =>'stopped',
:tag =>'neutron-service',
)
end
end
context 'neutron-bsn-lldp only' do
let :params do
{
:lldp_enabled => true,
:agent_enabled => false
}
end
it 'disable neutron-bsn-agent service' do
should contain_service('bigswitch-agent').with(
:enable => params[:agent_enabled],
:ensure =>'stopped',
:tag =>'neutron-service',
)
end
it 'enable neutron-bsn-lldp service' do
should contain_service('bigswitch-lldp').with(
:enable => params[:lldp_enabled],
:ensure =>'running',
:tag =>'neutron-service',
)
end
end
end
context 'neutron-bsn-agent only' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
end
let :params do
{
:lldp_enabled => false,
:agent_enabled => true
}
end
it_configures 'neutron bigswitch base'
it 'enable neutron-bsn-agent service' do
is_expected.to contain_service('bigswitch-agent').with(
:enable => params[:agent_enabled],
:ensure =>'running',
:tag =>'neutron-service',
)
end
it 'disable neutron-bsn-lldp service' do
is_expected.to contain_service('bigswitch-lldp').with(
:enable => params[:lldp_enabled],
:ensure =>'stopped',
:tag =>'neutron-service',
)
end
shared_examples 'neutron::agents::bigswitch on Debian' do
it { should raise_error(Puppet::Error, /Unsupported osfamily Debian/) }
end
context 'neutron-bsn-lldp only' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
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
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron::agents::bigswitch on Debian'
else
it_behaves_like 'neutron::agents::bigswitch'
end
end
let :params do
{
:lldp_enabled => true,
:agent_enabled => false
}
end
it_configures 'neutron bigswitch base'
it 'disable neutron-bsn-agent service' do
is_expected.to contain_service('bigswitch-agent').with(
:enable => params[:agent_enabled],
:ensure =>'stopped',
:tag =>'neutron-service',
)
end
it 'enable neutron-bsn-lldp service' do
is_expected.to contain_service('bigswitch-lldp').with(
:enable => params[:lldp_enabled],
:ensure =>'running',
:tag =>'neutron-service',
)
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian'
}))
end
let :params do
{
:lldp_enabled => false,
:agent_enabled => false
}
end
it { is_expected.to raise_error(Puppet::Error, /Unsupported osfamily Debian/) }
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::agents::dhcp' do
let :pre_condition do
"class { 'neutron': }"
end
@ -11,7 +10,8 @@ describe 'neutron::agents::dhcp' do
end
let :default_params do
{ :package_ensure => 'present',
{
:package_ensure => 'present',
:enabled => true,
:state_path => '/var/lib/neutron',
:resync_interval => 30,
@ -19,72 +19,67 @@ describe 'neutron::agents::dhcp' do
:root_helper => 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
:enable_isolated_metadata => false,
:enable_metadata_network => false,
:purge_config => false }
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
:purge_config => false
}
end
shared_examples_for 'neutron dhcp agent' do
shared_examples 'neutron dhcp agent' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'configures dhcp_agent.ini' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/state_path').with_value(p[:state_path]);
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/resync_interval').with_value(p[:resync_interval]);
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dhcp_driver').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/root_helper').with_value(p[:root_helper]);
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_isolated_metadata').with_value(p[:enable_isolated_metadata]);
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value(p[:enable_metadata_network]);
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dhcp_broadcast_reply').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/ovs_integration_bridge').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_local_resolv').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('AGENT/availability_zone').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('OVS/ovsdb_connection').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('OVS/ssl_key_file').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('OVS/ssl_cert_file').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_dhcp_agent_config('OVS/ssl_ca_cert_file').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('DEFAULT/state_path').with_value(p[:state_path]);
should contain_neutron_dhcp_agent_config('DEFAULT/resync_interval').with_value(p[:resync_interval]);
should contain_neutron_dhcp_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
should contain_neutron_dhcp_agent_config('DEFAULT/dhcp_driver').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('DEFAULT/root_helper').with_value(p[:root_helper]);
should contain_neutron_dhcp_agent_config('DEFAULT/enable_isolated_metadata').with_value(p[:enable_isolated_metadata]);
should contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value(p[:enable_metadata_network]);
should contain_neutron_dhcp_agent_config('DEFAULT/dhcp_broadcast_reply').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('DEFAULT/ovs_integration_bridge').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_local_resolv').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('AGENT/availability_zone').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('OVS/ovsdb_connection').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('OVS/ssl_key_file').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('OVS/ssl_cert_file').with_value('<SERVICE DEFAULT>');
should contain_neutron_dhcp_agent_config('OVS/ssl_ca_cert_file').with_value('<SERVICE DEFAULT>');
end
it 'installs neutron dhcp agent package' do
if platform_params.has_key?(:dhcp_agent_package)
is_expected.to contain_package('neutron-dhcp-agent').with(
should contain_package('neutron-dhcp-agent').with(
:name => platform_params[:dhcp_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
is_expected.to contain_package('neutron-dhcp-agent').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron-dhcp-agent').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron-dhcp-agent').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron-dhcp-agent').that_notifies('Anchor[neutron::install::end]')
else
is_expected.to contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
end
end
it 'configures neutron dhcp agent service' do
is_expected.to contain_service('neutron-dhcp-service').with(
should contain_service('neutron-dhcp-service').with(
:name => platform_params[:dhcp_agent_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('neutron-dhcp-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-dhcp-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-dhcp-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-dhcp-service').that_notifies('Anchor[neutron::service::end]')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_dhcp_agent_config').with({
should contain_resources('neutron_dhcp_agent_config').with({
:purge => false
})
end
@ -94,7 +89,7 @@ describe 'neutron::agents::dhcp' do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-dhcp-service').without_ensure
should contain_service('neutron-dhcp-service').without_ensure
end
end
@ -103,8 +98,8 @@ describe 'neutron::agents::dhcp' do
params.merge!(:enable_isolated_metadata => true, :enable_metadata_network => false)
end
it 'should enable isolated_metadata only' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_isolated_metadata').with_value('true');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('false');
should contain_neutron_dhcp_agent_config('DEFAULT/enable_isolated_metadata').with_value('true');
should contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('false');
end
end
@ -113,8 +108,8 @@ describe 'neutron::agents::dhcp' do
params.merge!(:enable_isolated_metadata => true, :enable_metadata_network => true)
end
it 'should enable both isolated_metadata and metadata_network' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_isolated_metadata').with_value('true');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('true');
should contain_neutron_dhcp_agent_config('DEFAULT/enable_isolated_metadata').with_value('true');
should contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('true');
end
end
@ -123,7 +118,7 @@ describe 'neutron::agents::dhcp' do
params.merge!(:enable_isolated_metadata => false, :enable_force_metadata => false, :enable_metadata_network => true)
end
it_raises 'a Puppet::Error', /enable_metadata_network to true requires enable_isolated_metadata or enable_force_metadata also enabled./
it { should raise_error(Puppet::Error, /enable_metadata_network to true requires enable_isolated_metadata or enable_force_metadata also enabled./) }
end
context 'when enabling force metadata only' do
@ -131,8 +126,8 @@ describe 'neutron::agents::dhcp' do
params.merge!(:enable_force_metadata => true, :enable_metadata_network => false)
end
it 'should enable force_metadata only' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('true');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('false');
should contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('true');
should contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('false');
end
end
@ -141,8 +136,8 @@ describe 'neutron::agents::dhcp' do
params.merge!(:enable_force_metadata => true, :enable_metadata_network => true)
end
it 'should enable both force_metadata and metadata_network' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('true');
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('true');
should contain_neutron_dhcp_agent_config('DEFAULT/force_metadata').with_value('true');
should contain_neutron_dhcp_agent_config('DEFAULT/enable_metadata_network').with_value('true');
end
end
@ -151,7 +146,7 @@ describe 'neutron::agents::dhcp' do
params.merge!(:availability_zone => 'zone1')
end
it 'should configure availability zone' do
is_expected.to contain_neutron_dhcp_agent_config('AGENT/availability_zone').with_value(p[:availability_zone]);
should contain_neutron_dhcp_agent_config('AGENT/availability_zone').with_value(p[:availability_zone]);
end
end
@ -165,10 +160,10 @@ describe 'neutron::agents::dhcp' do
})
end
it 'configures neutron SSL settings' do
is_expected.to contain_neutron_dhcp_agent_config('OVS/ovsdb_connection').with_value(params[:ovsdb_connection])
is_expected.to contain_neutron_dhcp_agent_config('OVS/ssl_key_file').with_value(params[:ovsdb_agent_ssl_key_file])
is_expected.to contain_neutron_dhcp_agent_config('OVS/ssl_cert_file').with_value(params[:ovsdb_agent_ssl_cert_file])
is_expected.to contain_neutron_dhcp_agent_config('OVS/ssl_ca_cert_file').with_value(params[:ovsdb_agent_ssl_ca_file])
should contain_neutron_dhcp_agent_config('OVS/ovsdb_connection').with_value(params[:ovsdb_connection])
should contain_neutron_dhcp_agent_config('OVS/ssl_key_file').with_value(params[:ovsdb_agent_ssl_key_file])
should contain_neutron_dhcp_agent_config('OVS/ssl_cert_file').with_value(params[:ovsdb_agent_ssl_cert_file])
should contain_neutron_dhcp_agent_config('OVS/ssl_ca_cert_file').with_value(params[:ovsdb_agent_ssl_ca_file])
end
end
@ -179,80 +174,79 @@ describe 'neutron::agents::dhcp' do
})
end
it 'fails to configure' do
is_expected.to raise_error(Puppet::Error)
should raise_error(Puppet::Error)
end
end
end
shared_examples_for 'neutron dhcp agent with dnsmasq_config_file specified' do
shared_examples 'neutron dhcp agent with dnsmasq_config_file specified' do
before do
params.merge!(
:dnsmasq_config_file => '/foo'
)
end
it 'configures dnsmasq_config_file' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_config_file').with_value(params[:dnsmasq_config_file])
should contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_config_file').with_value(params[:dnsmasq_config_file])
end
end
shared_examples_for 'enable advertisement of the DNS resolver on the host.' do
shared_examples 'enable advertisement of the DNS resolver on the host.' do
before do
params.merge!(
:dnsmasq_local_resolv => true
)
end
it 'configures dnsmasq_local_resolv' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_local_resolv').with_value(params[:dnsmasq_config_file])
should contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_local_resolv').with_value(params[:dnsmasq_config_file])
end
end
shared_examples_for 'neutron dhcp agent with dnsmasq_dns_servers set' do
shared_examples 'neutron dhcp agent with dnsmasq_dns_servers set' do
before do
params.merge!(
:dnsmasq_dns_servers => ['1.2.3.4','5.6.7.8']
)
end
it 'should set dnsmasq_dns_servers' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_dns_servers').with_value(params[:dnsmasq_dns_servers].join(','))
should contain_neutron_dhcp_agent_config('DEFAULT/dnsmasq_dns_servers').with_value(params[:dnsmasq_dns_servers].join(','))
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
let :platform_params do
{ :dhcp_agent_package => 'neutron-dhcp-agent',
:dhcp_agent_service => 'neutron-dhcp-agent' }
end
it_configures 'neutron dhcp agent'
it_configures 'neutron dhcp agent with dnsmasq_config_file specified'
it_configures 'neutron dhcp agent with dnsmasq_dns_servers set'
shared_examples 'neutron::agents::dhcp on Debian' do
it 'configures subscription to neutron-dhcp-agent package' do
is_expected.to contain_service('neutron-dhcp-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-dhcp-service').that_subscribes_to('Anchor[neutron::service::begin]')
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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
let :platform_params do
{ :dhcp_agent_service => 'neutron-dhcp-agent' }
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:dhcp_agent_package => 'neutron-dhcp-agent',
:dhcp_agent_service => 'neutron-dhcp-agent'
}
when 'RedHat'
{
:dhcp_agent_service => 'neutron-dhcp-agent'
}
end
end
it_configures 'neutron dhcp agent'
it_configures 'neutron dhcp agent with dnsmasq_config_file specified'
it_configures 'neutron dhcp agent with dnsmasq_dns_servers set'
it_behaves_like 'neutron dhcp agent'
it_behaves_like 'neutron dhcp agent with dnsmasq_config_file specified'
it_behaves_like 'neutron dhcp agent with dnsmasq_dns_servers set'
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron::agents::dhcp on Debian'
end
end
end
end

View File

@ -17,7 +17,6 @@
require 'spec_helper'
describe 'neutron::agents::l2gw' do
let :default_params do
{ :package_ensure => 'present',
:purge_config => false,
@ -33,44 +32,39 @@ describe 'neutron::agents::l2gw' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron l2 gateway agent' do
shared_examples 'neutron l2 gateway agent' do
let :p do
default_params.merge(params)
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_l2gw_agent_config').with({
should contain_resources('neutron_l2gw_agent_config').with({
:purge => false
})
end
it 'installs l2gw agent package' do
is_expected.to contain_package('neutron-l2gw-agent').with(
should contain_package('neutron-l2gw-agent').with(
:ensure => p[:package_ensure],
:name => platform_params[:l2gw_agent_package_name],
)
end
it 'configures l2gw_plugin.ini' do
is_expected.to contain_neutron_l2gw_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/enable_manager').with_value(p[:enable_manager])
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/manager_table_listening_port').with_value(p[:manager_table_listening_port])
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/l2_gw_agent_priv_key_base_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/l2_gw_agent_cert_base_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/l2_gw_agent_ca_cert_base_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/periodic_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/max_connection_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/socket_timeout').with_value(p[:socket_timeout])
is_expected.to contain_neutron_l2gw_agent_config('ovsdb/ovsdb_hosts').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_agent_config('ovsdb/enable_manager').with_value(p[:enable_manager])
should contain_neutron_l2gw_agent_config('ovsdb/manager_table_listening_port').with_value(p[:manager_table_listening_port])
should contain_neutron_l2gw_agent_config('ovsdb/l2_gw_agent_priv_key_base_path').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_agent_config('ovsdb/l2_gw_agent_cert_base_path').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_agent_config('ovsdb/l2_gw_agent_ca_cert_base_path').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_agent_config('ovsdb/periodic_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_agent_config('ovsdb/max_connection_retries').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_agent_config('ovsdb/socket_timeout').with_value(p[:socket_timeout])
should contain_neutron_l2gw_agent_config('ovsdb/ovsdb_hosts').with_value('<SERVICE DEFAULT>')
end
it 'l2 agent service running' do
is_expected.to contain_service('neutron-l2gw-agent').with_ensure('running')
should contain_service('neutron-l2gw-agent').with_ensure('running')
end
context 'with multiple ovsdb_hosts' do
@ -81,7 +75,7 @@ describe 'neutron::agents::l2gw' do
end
it 'configures multiple ovsdb_hosts in l2gateway_agent.ini' do
is_expected.to contain_neutron_l2gw_agent_config(
should contain_neutron_l2gw_agent_config(
'ovsdb/ovsdb_hosts'
).with_value(p[:ovsdb_hosts].join(','))
end
@ -105,7 +99,7 @@ describe 'neutron::agents::l2gw' do
end
end
it_configures 'neutron l2 gateway agent'
it_behaves_like 'neutron l2 gateway agent'
end
end
end

View File

@ -1,70 +1,65 @@
require 'spec_helper'
describe 'neutron::agents::l3' do
let :pre_condition do
"class { 'neutron': }"
end
let :default_params do
{ :package_ensure => 'present',
{
:package_ensure => 'present',
:enabled => true,
:interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
:ha_enabled => false,
:ha_vrrp_auth_type => 'PASS',
:ha_vrrp_advert_int => '3',
:agent_mode => 'legacy',
:purge_config => false }
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
:purge_config => false
}
end
let :params do
{ }
{}
end
shared_examples_for 'neutron l3 agent' do
shared_examples 'neutron l3 agent' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'configures l3_agent.ini' do
is_expected.to contain_neutron_l3_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver])
is_expected.to contain_neutron_l3_agent_config('DEFAULT/gateway_external_network_id').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/handle_internal_only_routers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/metadata_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/periodic_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/periodic_fuzzy_delay').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/enable_metadata_proxy').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('AGENT/availability_zone').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l3_agent_config('AGENT/extensions').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver])
should contain_neutron_l3_agent_config('DEFAULT/gateway_external_network_id').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/handle_internal_only_routers').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/metadata_port').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/periodic_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/periodic_fuzzy_delay').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('DEFAULT/enable_metadata_proxy').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('AGENT/availability_zone').with_value('<SERVICE DEFAULT>')
should contain_neutron_l3_agent_config('AGENT/extensions').with_value('<SERVICE DEFAULT>')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_l3_agent_config').with({
should contain_resources('neutron_l3_agent_config').with({
:purge => false
})
end
it 'installs neutron l3 agent package' do
if platform_params.has_key?(:l3_agent_package)
is_expected.to contain_package('neutron-l3').with(
should contain_package('neutron-l3').with(
:name => platform_params[:l3_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-l3').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron-l3').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron-l3').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron-l3').that_notifies('Anchor[neutron::install::end]')
else
is_expected.to contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
end
end
@ -73,14 +68,14 @@ describe 'neutron::agents::l3' do
params.merge!(:manage_service => true)
end
it 'configures neutron l3 agent service' do
is_expected.to contain_service('neutron-l3').with(
should contain_service('neutron-l3').with(
:name => platform_params[:l3_agent_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('neutron-l3').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-l3').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-l3').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-l3').that_notifies('Anchor[neutron::service::end]')
end
end
@ -89,7 +84,7 @@ describe 'neutron::agents::l3' do
params.merge!(:agent_mode => 'dvr')
end
it 'should enable DVR mode' do
is_expected.to contain_neutron_l3_agent_config('DEFAULT/agent_mode').with_value(p[:agent_mode])
should contain_neutron_l3_agent_config('DEFAULT/agent_mode').with_value(p[:agent_mode])
end
end
@ -99,9 +94,9 @@ describe 'neutron::agents::l3' do
:ha_vrrp_auth_password => 'secrete')
end
it 'should configure VRRP' do
is_expected.to contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_type').with_value(p[:ha_vrrp_auth_type])
is_expected.to contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_password').with_value(p[:ha_vrrp_auth_password])
is_expected.to contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_advert_int').with_value(p[:ha_vrrp_advert_int])
should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_type').with_value(p[:ha_vrrp_auth_type])
should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_password').with_value(p[:ha_vrrp_auth_password])
should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_advert_int').with_value(p[:ha_vrrp_advert_int])
end
end
@ -111,44 +106,41 @@ describe 'neutron::agents::l3' do
end
it 'configures availability zone' do
is_expected.to contain_neutron_l3_agent_config('AGENT/availability_zone').with_value(p[:availability_zone])
should contain_neutron_l3_agent_config('AGENT/availability_zone').with_value(p[:availability_zone])
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
let :platform_params do
{ :l3_agent_package => 'neutron-l3-agent',
:l3_agent_service => 'neutron-l3-agent' }
end
it_configures 'neutron l3 agent'
shared_examples 'neutron::agents::l3 on Debian' do
it 'configures neutron-l3 package subscription' do
is_expected.to contain_service('neutron-l3').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-l3').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-l3').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-l3').that_notifies('Anchor[neutron::service::end]')
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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
let :platform_params do
{ :l3_agent_service => 'neutron-l3-agent' }
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:l3_agent_package => 'neutron-l3-agent',
:l3_agent_service => 'neutron-l3-agent'
}
when 'RedHat'
{
:l3_agent_service => 'neutron-l3-agent'
}
end
end
it_configures 'neutron l3 agent'
it_behaves_like 'neutron l3 agent'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::agents::lbaas' do
let :pre_condition do
"class { 'neutron': }"
end
@ -20,55 +19,48 @@ describe 'neutron::agents::lbaas' do
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron lbaas agent' do
shared_examples 'neutron lbaas agent' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it_configures 'haproxy lbaas_driver'
it_configures 'haproxy lbaas_driver without package'
it_behaves_like 'haproxy lbaas_driver'
it_behaves_like 'haproxy lbaas_driver without package'
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_lbaas_agent_config').with({
should contain_resources('neutron_lbaas_agent_config').with({
:purge => false
})
end
it 'configures lbaas_agent.ini' do
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/device_driver').with_value(p[:device_driver]);
is_expected.to contain_neutron_lbaas_agent_config('haproxy/user_group').with_value(platform_params[:nobody_user_group]);
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/ovs_use_veth').with_value('<SERVICE DEFAULT>');
should contain_neutron_lbaas_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>');
should contain_neutron_lbaas_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
should contain_neutron_lbaas_agent_config('DEFAULT/device_driver').with_value(p[:device_driver]);
should contain_neutron_lbaas_agent_config('haproxy/user_group').with_value(platform_params[:nobody_user_group]);
should contain_neutron_lbaas_agent_config('DEFAULT/ovs_use_veth').with_value('<SERVICE DEFAULT>');
end
it 'installs neutron lbaas agent package' do
is_expected.to contain_package('neutron-lbaasv2-agent').with(
should contain_package('neutron-lbaasv2-agent').with(
:name => platform_params[:lbaas_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').with_before(/Package\[neutron-lbaasv2-agent\]/)
should contain_package('neutron').with_before(/Package\[neutron-lbaasv2-agent\]/)
end
it 'configures neutron lbaas agent service' do
is_expected.to contain_service('neutron-lbaasv2-service').with(
should contain_service('neutron-lbaasv2-service').with(
:name => platform_params[:lbaas_agent_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('neutron-lbaasv2-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-lbaasv2-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-lbaasv2-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-lbaasv2-service').that_notifies('Anchor[neutron::service::end]')
end
context 'with manage_service as false' do
@ -76,7 +68,7 @@ describe 'neutron::agents::lbaas' do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-lbaasv2-service').with(
should contain_service('neutron-lbaasv2-service').with(
:ensure => 'stopped',
)
end
@ -87,7 +79,7 @@ describe 'neutron::agents::lbaas' do
params.merge!(:ovs_use_veth => false)
end
it 'should have ovs_use_veth set to false' do
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/ovs_use_veth').with_value(false);
should contain_neutron_lbaas_agent_config('DEFAULT/ovs_use_veth').with_value(false);
end
end
@ -96,23 +88,23 @@ describe 'neutron::agents::lbaas' do
params.merge!(:device_driver => '<SERVICE DEFAULT>')
end
it 'should have devcie_driver set to $::os_service_default' do
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/device_driver').with_value('<SERVICE DEFAULT>');
should contain_neutron_lbaas_agent_config('DEFAULT/device_driver').with_value('<SERVICE DEFAULT>');
end
end
end
shared_examples_for 'haproxy lbaas_driver' do
shared_examples 'haproxy lbaas_driver' do
it 'installs haproxy packages' do
if platform_params.has_key?(:lbaas_agent_package)
is_expected.to contain_package(platform_params[:haproxy_package]).with_before(['Package[neutron-lbaasv2-agent]'])
should contain_package(platform_params[:haproxy_package]).with_before(['Package[neutron-lbaasv2-agent]'])
end
is_expected.to contain_package(platform_params[:haproxy_package]).with(
should contain_package(platform_params[:haproxy_package]).with(
:ensure => 'present'
)
end
end
shared_examples_for 'haproxy lbaas_driver without package' do
shared_examples 'haproxy lbaas_driver without package' do
let :pre_condition do
"package { 'haproxy':
ensure => 'present'
@ -123,50 +115,40 @@ describe 'neutron::agents::lbaas' do
params.merge!(:manage_haproxy_package => false)
end
it 'installs haproxy package via haproxy module' do
is_expected.to contain_package(platform_params[:haproxy_package]).with(
should contain_package(platform_params[:haproxy_package]).with(
:ensure => 'present'
)
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
:concat_basedir => '/dne'
}
))
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( :concat_basedir => '/dne' ))
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:haproxy_package => 'haproxy',
:lbaas_agent_package => 'neutron-lbaasv2-agent',
:nobody_user_group => 'nogroup',
:lbaas_agent_service => 'neutron-lbaasv2-agent'
}
when 'RedHat'
{
:haproxy_package => 'haproxy',
:lbaas_agent_package => 'openstack-neutron-lbaas',
:nobody_user_group => 'nobody',
:lbaas_agent_service => 'neutron-lbaasv2-agent'
}
end
end
it_behaves_like 'neutron lbaas agent'
end
let :platform_params do
{ :haproxy_package => 'haproxy',
:lbaas_agent_package => 'neutron-lbaasv2-agent',
:nobody_user_group => 'nogroup',
:lbaas_agent_service => 'neutron-lbaasv2-agent' }
end
it_configures 'neutron lbaas agent'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
:concat_basedir => '/dne'
}
))
end
let :platform_params do
{ :haproxy_package => 'haproxy',
:lbaas_agent_package => 'openstack-neutron-lbaas',
:nobody_user_group => 'nobody',
:lbaas_agent_service => 'neutron-lbaasv2-agent' }
end
it_configures 'neutron lbaas agent'
end
end

View File

@ -1,75 +1,71 @@
require 'spec_helper'
describe 'neutron::agents::metadata' do
let :pre_condition do
"class { 'neutron': }"
end
let :params do
{ :package_ensure => 'present',
:enabled => true,
:shared_secret => 'metadata-secret',
:purge_config => false,
{
:package_ensure => 'present',
:enabled => true,
:shared_secret => 'metadata-secret',
:purge_config => false,
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples 'neutron metadata agent' do
shared_examples_for 'neutron metadata agent' do
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'configures neutron metadata agent service' do
is_expected.to contain_service('neutron-metadata').with(
should contain_service('neutron-metadata').with(
:name => platform_params[:metadata_agent_service],
:enable => params[:enabled],
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('neutron-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-metadata').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-metadata').that_notifies('Anchor[neutron::service::end]')
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-metadata').without_ensure
should contain_service('neutron-metadata').without_ensure
end
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_metadata_agent_config').with({
should contain_resources('neutron_metadata_agent_config').with({
:purge => false
})
end
it 'configures metadata_agent.ini' do
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/debug').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/auth_ca_cert').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_client_cert').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_client_priv_key').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_ip').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_host').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_port').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_protocol').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:os_workers])
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_insecure').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/metadata_proxy_shared_secret').with(:value => params[:shared_secret]).with_secret(true)
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/cache_url').with(:ensure => 'absent')
should contain_neutron_metadata_agent_config('DEFAULT/debug').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/auth_ca_cert').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/nova_client_cert').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/nova_client_priv_key').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_ip').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_host').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_port').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_protocol').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:os_workers])
should contain_neutron_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_insecure').with(:value => '<SERVICE DEFAULT>')
should contain_neutron_metadata_agent_config('DEFAULT/metadata_proxy_shared_secret').with(:value => params[:shared_secret]).with_secret(true)
should contain_neutron_metadata_agent_config('DEFAULT/cache_url').with(:ensure => 'absent')
end
end
shared_examples_for 'neutron metadata agent with auth_ca_cert set' do
shared_examples 'neutron metadata agent with auth_ca_cert set' do
let :params do
{ :auth_ca_cert => '/some/cert',
{
:auth_ca_cert => '/some/cert',
:shared_secret => '42',
:nova_client_cert => '/nova/cert',
:nova_client_priv_key => '/nova/key',
@ -78,56 +74,56 @@ describe 'neutron::agents::metadata' do
end
it 'configures certificate' do
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/auth_ca_cert').with_value('/some/cert')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_client_cert').with_value('/nova/cert')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_client_priv_key').with_value('/nova/key')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_insecure').with_value(true)
should contain_neutron_metadata_agent_config('DEFAULT/auth_ca_cert').with_value('/some/cert')
should contain_neutron_metadata_agent_config('DEFAULT/nova_client_cert').with_value('/nova/cert')
should contain_neutron_metadata_agent_config('DEFAULT/nova_client_priv_key').with_value('/nova/key')
should contain_neutron_metadata_agent_config('DEFAULT/nova_metadata_insecure').with_value(true)
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } } }
))
end
let :platform_params do
{ :metadata_agent_package => 'neutron-metadata-agent',
:metadata_agent_service => 'neutron-metadata-agent' }
end
shared_examples 'neutron::agents::metadata on Debian' do
it 'installs neutron metadata agent package' do
is_expected.to contain_package('neutron-metadata').with(
should contain_package('neutron-metadata').with(
:ensure => params[:package_ensure],
:name => platform_params[:metadata_agent_package],
:tag => ['openstack', 'neutron-package'],
)
end
it_configures 'neutron metadata agent'
it_configures 'neutron metadata agent with auth_ca_cert set'
it 'configures subscription to neutron-metadata package' do
is_expected.to contain_service('neutron-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-metadata').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-metadata').that_notifies('Anchor[neutron::service::end]')
end
end
context 'on Red Hat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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
let :platform_params do
{ :metadata_agent_service => 'neutron-metadata-agent' }
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:metadata_agent_package => 'neutron-metadata-agent',
:metadata_agent_service => 'neutron-metadata-agent'
}
when 'RedHat'
{
:metadata_agent_service => 'neutron-metadata-agent'
}
end
end
it_configures 'neutron metadata agent'
it_configures 'neutron metadata agent with auth_ca_cert set'
it_behaves_like 'neutron metadata agent'
it_behaves_like 'neutron metadata agent with auth_ca_cert set'
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron::agents::metadata on Debian'
end
end
end
end

View File

@ -21,10 +21,10 @@
require 'spec_helper'
describe 'neutron::agents::metering' do
let :pre_condition do
"class { 'neutron':
service_plugins => ['neutron.services.metering.metering_plugin.MeteringPlugin'] }"
service_plugins => ['neutron.services.metering.metering_plugin.MeteringPlugin']
}"
end
let :params do
@ -32,7 +32,8 @@ describe 'neutron::agents::metering' do
end
let :default_params do
{ :package_ensure => 'present',
{
:package_ensure => 'present',
:enabled => true,
:interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
:driver => 'neutron.services.metering.drivers.noop.noop_driver.NoopMeteringDriver',
@ -40,62 +41,57 @@ describe 'neutron::agents::metering' do
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron metering agent' do
shared_examples 'neutron metering agent' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_metering_agent_config').with({
should contain_resources('neutron_metering_agent_config').with({
:purge => false
})
end
it 'configures metering_agent.ini' do
is_expected.to contain_neutron_metering_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_metering_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
is_expected.to contain_neutron_metering_agent_config('DEFAULT/driver').with_value(p[:driver]);
is_expected.to contain_neutron_metering_agent_config('DEFAULT/measure_interval').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_metering_agent_config('DEFAULT/report_interval').with_value('<SERVICE DEFAULT>');
should contain_neutron_metering_agent_config('DEFAULT/debug').with_value('<SERVICE DEFAULT>');
should contain_neutron_metering_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
should contain_neutron_metering_agent_config('DEFAULT/driver').with_value(p[:driver]);
should contain_neutron_metering_agent_config('DEFAULT/measure_interval').with_value('<SERVICE DEFAULT>');
should contain_neutron_metering_agent_config('DEFAULT/report_interval').with_value('<SERVICE DEFAULT>');
end
it 'installs neutron metering agent package' do
if platform_params.has_key?(:metering_agent_package)
is_expected.to contain_package('neutron-metering-agent').with(
should contain_package('neutron-metering-agent').with(
:name => platform_params[:metering_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
end
end
it 'configures neutron metering agent service' do
is_expected.to contain_service('neutron-metering-service').with(
should contain_service('neutron-metering-service').with(
:name => platform_params[:metering_agent_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('neutron-metering-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-metering-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-metering-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-metering-service').that_notifies('Anchor[neutron::service::end]')
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-metering-service').without_ensure
should contain_service('neutron-metering-service').without_ensure
end
end
@ -103,46 +99,48 @@ describe 'neutron::agents::metering' do
before :each do
params.merge!(:driver => 'neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver')
end
it 'should properly set driver option' do
is_expected.to contain_neutron_metering_agent_config('DEFAULT/driver').with_value(p[:driver])
should contain_neutron_metering_agent_config('DEFAULT/driver').with_value(p[:driver])
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
let :platform_params do
{ :metering_agent_package => 'neutron-metering-agent',
:metering_agent_service => 'neutron-metering-agent' }
end
it_configures 'neutron metering agent'
shared_examples 'neutron metering agent on Debian' do
it 'configures subscription to neutron-metering-agent package' do
is_expected.to contain_service('neutron-metering-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-metering-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-metering-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-metering-service').that_notifies('Anchor[neutron::service::end]')
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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
let :platform_params do
{ :metering_agent_package => 'openstack-neutron-metering-agent',
:metering_agent_service => 'neutron-metering-agent' }
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:metering_agent_package => 'neutron-metering-agent',
:metering_agent_service => 'neutron-metering-agent'
}
when 'RedHat'
{
:metering_agent_package => 'openstack-neutron-metering-agent',
:metering_agent_service => 'neutron-metering-agent'
}
end
end
it_configures 'neutron metering agent'
it_behaves_like 'neutron metering agent'
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron metering agent on Debian'
end
end
end
end

View File

@ -1,13 +1,13 @@
require 'spec_helper'
describe 'neutron::agents::ml2::linuxbridge' do
let :pre_condition do
"class { 'neutron': }"
end
let :default_params do
{ :package_ensure => 'present',
{
:package_ensure => 'present',
:enabled => true,
:manage_service => true,
:tunnel_types => [],
@ -18,33 +18,26 @@ describe 'neutron::agents::ml2::linuxbridge' do
:purge_config => false,}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
let :params do
{}
end
shared_examples_for 'neutron plugin linuxbridge agent with ml2 plugin' do
shared_examples 'neutron plugin linuxbridge agent with ml2 plugin' do
context 'with default parameters' do
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_agent_linuxbridge').with({
should contain_resources('neutron_agent_linuxbridge').with({
:purge => false
})
end
it 'configures ml2_conf.ini' do
is_expected.to contain_neutron_agent_linuxbridge('agent/polling_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_linuxbridge('linux_bridge/physical_interface_mappings').with_value(default_params[:physical_interface_mappings].join(','))
is_expected.to contain_neutron_agent_linuxbridge('linux_bridge/bridge_mappings').with_ensure('absent')
is_expected.to contain_neutron_agent_linuxbridge('securitygroup/firewall_driver').with_value(default_params[:firewall_driver])
is_expected.to contain_neutron_agent_linuxbridge('agent/tunnel_types').with_ensure('absent')
should contain_neutron_agent_linuxbridge('agent/polling_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_linuxbridge('linux_bridge/physical_interface_mappings').with_value(default_params[:physical_interface_mappings].join(','))
should contain_neutron_agent_linuxbridge('linux_bridge/bridge_mappings').with_ensure('absent')
should contain_neutron_agent_linuxbridge('securitygroup/firewall_driver').with_value(default_params[:firewall_driver])
should contain_neutron_agent_linuxbridge('agent/tunnel_types').with_ensure('absent')
end
it 'installs neutron linuxbridge agent package' do
@ -54,23 +47,22 @@ describe 'neutron::agents::ml2::linuxbridge' do
linuxbridge_agent_package = platform_params[:linuxbridge_server_package]
end
is_expected.to contain_package('neutron-plugin-linuxbridge-agent').with(
should contain_package('neutron-plugin-linuxbridge-agent').with(
:name => linuxbridge_agent_package,
:ensure => default_params[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
end
it 'configures neutron linuxbridge agent service' do
is_expected.to contain_service('neutron-plugin-linuxbridge-agent').with(
should contain_service('neutron-plugin-linuxbridge-agent').with(
:name => platform_params[:linuxbridge_agent_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('neutron-plugin-linuxbridge-agent').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-plugin-linuxbridge-agent').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-plugin-linuxbridge-agent').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-plugin-linuxbridge-agent').that_notifies('Anchor[neutron::service::end]')
end
context 'with manage_service as false' do
@ -78,15 +70,15 @@ describe 'neutron::agents::ml2::linuxbridge' do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-plugin-linuxbridge-agent').without_ensure
should contain_service('neutron-plugin-linuxbridge-agent').without_ensure
end
end
it 'does not configre VXLAN tunneling' do
is_expected.to contain_neutron_agent_linuxbridge('vxlan/enable_vxlan').with_value(false)
is_expected.to contain_neutron_agent_linuxbridge('vxlan/local_ip').with_ensure('absent')
is_expected.not_to contain_neutron_agent_linuxbridge('vxlan/vxlan_group')
is_expected.not_to contain_neutron_agent_linuxbridge('vxlan/l2_population')
should contain_neutron_agent_linuxbridge('vxlan/enable_vxlan').with_value(false)
should contain_neutron_agent_linuxbridge('vxlan/local_ip').with_ensure('absent')
should_not contain_neutron_agent_linuxbridge('vxlan/vxlan_group')
should_not contain_neutron_agent_linuxbridge('vxlan/l2_population')
end
end
@ -100,12 +92,12 @@ describe 'neutron::agents::ml2::linuxbridge' do
context 'when providing all parameters' do
it 'configures ml2_conf.ini' do
is_expected.to contain_neutron_agent_linuxbridge('vxlan/local_ip').with_value(params[:local_ip])
is_expected.to contain_neutron_agent_linuxbridge('vxlan/vxlan_group').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_linuxbridge('vxlan/ttl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_linuxbridge('vxlan/tos').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_linuxbridge('vxlan/l2_population').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_linuxbridge('agent/tunnel_types').with_value(params[:tunnel_types])
should contain_neutron_agent_linuxbridge('vxlan/local_ip').with_value(params[:local_ip])
should contain_neutron_agent_linuxbridge('vxlan/vxlan_group').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_linuxbridge('vxlan/ttl').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_linuxbridge('vxlan/tos').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_linuxbridge('vxlan/l2_population').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_linuxbridge('agent/tunnel_types').with_value(params[:tunnel_types])
end
end
@ -120,11 +112,11 @@ describe 'neutron::agents::ml2::linuxbridge' do
end
it 'configures ml2_conf.ini' do
is_expected.to contain_neutron_agent_linuxbridge('vxlan/local_ip').with_value(params[:local_ip])
is_expected.to contain_neutron_agent_linuxbridge('vxlan/vxlan_group').with_value(params[:vxlan_group])
is_expected.to contain_neutron_agent_linuxbridge('vxlan/ttl').with_value(params[:vxlan_ttl])
is_expected.to contain_neutron_agent_linuxbridge('vxlan/tos').with_value(params[:vxlan_tos])
is_expected.to contain_neutron_agent_linuxbridge('vxlan/l2_population').with_value(params[:l2_population])
should contain_neutron_agent_linuxbridge('vxlan/local_ip').with_value(params[:local_ip])
should contain_neutron_agent_linuxbridge('vxlan/vxlan_group').with_value(params[:vxlan_group])
should contain_neutron_agent_linuxbridge('vxlan/ttl').with_value(params[:vxlan_ttl])
should contain_neutron_agent_linuxbridge('vxlan/tos').with_value(params[:vxlan_tos])
should contain_neutron_agent_linuxbridge('vxlan/l2_population').with_value(params[:l2_population])
end
end
end
@ -135,7 +127,7 @@ describe 'neutron::agents::ml2::linuxbridge' do
end
it 'configures physical interface mappings' do
is_expected.to contain_neutron_agent_linuxbridge('linux_bridge/physical_interface_mappings').with_value(
should contain_neutron_agent_linuxbridge('linux_bridge/physical_interface_mappings').with_value(
params[:physical_interface_mappings].join(',')
)
end
@ -147,7 +139,7 @@ describe 'neutron::agents::ml2::linuxbridge' do
end
it 'configures bridge mappings' do
is_expected.to contain_neutron_agent_linuxbridge('linux_bridge/bridge_mappings').with_value(
should contain_neutron_agent_linuxbridge('linux_bridge/bridge_mappings').with_value(
params[:bridge_mappings].join(',')
)
end
@ -158,39 +150,35 @@ describe 'neutron::agents::ml2::linuxbridge' do
params.merge!(:firewall_driver => false)
end
it 'removes firewall driver configuration' do
is_expected.to contain_neutron_agent_linuxbridge('securitygroup/firewall_driver').with_ensure('absent')
should contain_neutron_agent_linuxbridge('securitygroup/firewall_driver').with_ensure('absent')
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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
let :platform_params do
{ :linuxbridge_agent_package => 'neutron-linuxbridge-agent',
:linuxbridge_agent_service => 'neutron-linuxbridge-agent' }
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:linuxbridge_agent_package => 'neutron-linuxbridge-agent',
:linuxbridge_agent_service => 'neutron-linuxbridge-agent'
}
when 'RedHat'
{
:linuxbridge_server_package => 'openstack-neutron-linuxbridge',
:linuxbridge_agent_service => 'neutron-linuxbridge-agent'
}
end
end
it_configures 'neutron plugin linuxbridge agent with ml2 plugin'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
let :platform_params do
{ :linuxbridge_server_package => 'openstack-neutron-linuxbridge',
:linuxbridge_agent_service => 'neutron-linuxbridge-agent' }
it_behaves_like 'neutron plugin linuxbridge agent with ml2 plugin'
end
end
end

View File

@ -1,9 +1,9 @@
require 'spec_helper'
describe 'neutron::agents::ml2::networking_baremetal' do
let :default_params do
{ :enabled => true,
{
:enabled => true,
:manage_service => true,
:package_ensure => 'present',
:auth_type => 'password',
@ -18,69 +18,64 @@ describe 'neutron::agents::ml2::networking_baremetal' do
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
let :params do
{ :password => 'passw0rd',
{
:password => 'passw0rd',
}
end
shared_examples_for 'networking-baremetal ironic-neutron-agent with ml2 plugin' do
shared_examples 'networking-baremetal ironic-neutron-agent with ml2 plugin' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'passes purge to resource' do
is_expected.to contain_resources('ironic_neutron_agent_config').with({
should contain_resources('ironic_neutron_agent_config').with({
:purge => false
})
end
it 'configures /etc/neutron/plugins/ml2/ironic_neutron_agent.ini' do
is_expected.to contain_ironic_neutron_agent_config('ironic/auth_strategy').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_neutron_agent_config('ironic/ironic_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_neutron_agent_config('ironic/cafile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_neutron_agent_config('ironic/certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_neutron_agent_config('ironic/keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_neutron_agent_config('ironic/auth_type').with_value(p[:auth_type])
is_expected.to contain_ironic_neutron_agent_config('ironic/auth_url').with_value(p[:auth_url])
is_expected.to contain_ironic_neutron_agent_config('ironic/username').with_value(p[:username])
is_expected.to contain_ironic_neutron_agent_config('ironic/password').with_value(p[:password])
is_expected.to contain_ironic_neutron_agent_config('ironic/project_domain_id').with_value(p[:project_domain_id])
is_expected.to contain_ironic_neutron_agent_config('ironic/project_domain_name').with_value(p[:project_domain_name])
is_expected.to contain_ironic_neutron_agent_config('ironic/project_name').with_value(p[:project_name])
is_expected.to contain_ironic_neutron_agent_config('ironic/user_domain_id').with_value(p[:user_domain_id])
is_expected.to contain_ironic_neutron_agent_config('ironic/user_domain_name').with_value(p[:user_domain_name])
is_expected.to contain_ironic_neutron_agent_config('ironic/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_neutron_agent_config('ironic/retry_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_ironic_neutron_agent_config('ironic/max_retries').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/auth_strategy').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/ironic_url').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/cafile').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/certfile').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/keyfile').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/auth_type').with_value(p[:auth_type])
should contain_ironic_neutron_agent_config('ironic/auth_url').with_value(p[:auth_url])
should contain_ironic_neutron_agent_config('ironic/username').with_value(p[:username])
should contain_ironic_neutron_agent_config('ironic/password').with_value(p[:password])
should contain_ironic_neutron_agent_config('ironic/project_domain_id').with_value(p[:project_domain_id])
should contain_ironic_neutron_agent_config('ironic/project_domain_name').with_value(p[:project_domain_name])
should contain_ironic_neutron_agent_config('ironic/project_name').with_value(p[:project_name])
should contain_ironic_neutron_agent_config('ironic/user_domain_id').with_value(p[:user_domain_id])
should contain_ironic_neutron_agent_config('ironic/user_domain_name').with_value(p[:user_domain_name])
should contain_ironic_neutron_agent_config('ironic/region_name').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/retry_interval').with_value('<SERVICE DEFAULT>')
should contain_ironic_neutron_agent_config('ironic/max_retries').with_value('<SERVICE DEFAULT>')
end
it 'installs ironic-neutron-agent agent package' do
is_expected.to contain_package('python2-ironic-neutron-agent').with(
should contain_package('python2-ironic-neutron-agent').with(
:name => platform_params[:networking_baremetal_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('python2-ironic-neutron-agent').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('python2-ironic-neutron-agent').that_notifies('Anchor[neutron::install::end]')
should contain_package('python2-ironic-neutron-agent').that_requires('Anchor[neutron::install::begin]')
should contain_package('python2-ironic-neutron-agent').that_notifies('Anchor[neutron::install::end]')
end
it 'configures networking-baremetal ironic-neutron-agent service' do
is_expected.to contain_service('ironic-neutron-agent-service').with(
should contain_service('ironic-neutron-agent-service').with(
:name => platform_params[:networking_baremetal_agent_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('ironic-neutron-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('ironic-neutron-agent-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('ironic-neutron-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('ironic-neutron-agent-service').that_notifies('Anchor[neutron::service::end]')
end
context 'with enabled as false' do
@ -88,14 +83,14 @@ describe 'neutron::agents::ml2::networking_baremetal' do
params.merge!(:enabled => false)
end
it 'should not start service' do
is_expected.to contain_service('ironic-neutron-agent-service').with(
should contain_service('ironic-neutron-agent-service').with(
:name => platform_params[:networking_baremetal_agent_service],
:enable => false,
:ensure => 'stopped',
:tag => 'neutron-service',
)
is_expected.to contain_service('ironic-neutron-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('ironic-neutron-agent-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('ironic-neutron-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('ironic-neutron-agent-service').that_notifies('Anchor[neutron::service::end]')
end
end
end
@ -119,10 +114,9 @@ describe 'neutron::agents::ml2::networking_baremetal' do
it_behaves_like 'networking-baremetal ironic-neutron-agent with ml2 plugin'
when facts[:osfamily] != 'RedHat'
it 'fails with unsupported osfamily' do
is_expected.to raise_error(Puppet::Error, /Unsupported osfamily.*/)
should raise_error(Puppet::Error, /Unsupported osfamily.*/)
end
end
end
end
end

View File

@ -26,44 +26,44 @@ describe 'neutron::agents::ml2::ovs' do
{}
end
shared_examples_for 'neutron plugin ovs agent with ml2 plugin' do
shared_examples 'neutron plugin ovs agent with ml2 plugin' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_agent_ovs').with({
should contain_resources('neutron_agent_ovs').with({
:purge => false
})
end
it 'configures plugins/ml2/openvswitch_agent.ini' do
is_expected.to contain_neutron_agent_ovs('agent/polling_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_ovs('agent/l2_population').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_ovs('agent/arp_responder').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_ovs('agent/drop_flows_on_start').with_value(p[:drop_flows_on_start])
is_expected.to contain_neutron_agent_ovs('agent/extensions').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('agent/minimize_polling').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('agent/tunnel_csum').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/datapath_type').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/vhostuser_socket_dir').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/ovsdb_interface').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/integration_bridge').with_value(p[:integration_bridge])
is_expected.to contain_neutron_agent_ovs('securitygroup/firewall_driver').\
should contain_neutron_agent_ovs('agent/polling_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/l2_population').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/arp_responder').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/drop_flows_on_start').with_value(p[:drop_flows_on_start])
should contain_neutron_agent_ovs('agent/extensions').with_value(['<SERVICE DEFAULT>'])
should contain_neutron_agent_ovs('agent/minimize_polling').with_value(['<SERVICE DEFAULT>'])
should contain_neutron_agent_ovs('agent/tunnel_csum').with_value(['<SERVICE DEFAULT>'])
should contain_neutron_agent_ovs('ovs/datapath_type').with_value(['<SERVICE DEFAULT>'])
should contain_neutron_agent_ovs('ovs/vhostuser_socket_dir').with_value(['<SERVICE DEFAULT>'])
should contain_neutron_agent_ovs('ovs/ovsdb_interface').with_value(['<SERVICE DEFAULT>'])
should contain_neutron_agent_ovs('ovs/integration_bridge').with_value(p[:integration_bridge])
should contain_neutron_agent_ovs('securitygroup/firewall_driver').\
with_value(p[:firewall_driver])
is_expected.to contain_neutron_agent_ovs('securitygroup/enable_security_group').\
should contain_neutron_agent_ovs('securitygroup/enable_security_group').\
with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/tunnel_bridge').with_ensure('absent')
is_expected.to contain_neutron_agent_ovs('ovs/local_ip').with_ensure('absent')
is_expected.to contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_ensure('absent')
is_expected.to contain_neutron_agent_ovs('ovs/tun_peer_patch_port').with_ensure('absent')
should contain_neutron_agent_ovs('ovs/tunnel_bridge').with_ensure('absent')
should contain_neutron_agent_ovs('ovs/local_ip').with_ensure('absent')
should contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_ensure('absent')
should contain_neutron_agent_ovs('ovs/tun_peer_patch_port').with_ensure('absent')
end
it 'installs neutron ovs agent package' do
if platform_params.has_key?(:ovs_agent_package)
is_expected.to contain_package('neutron-ovs-agent').with(
should contain_package('neutron-ovs-agent').with(
:name => platform_params[:ovs_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
@ -73,14 +73,14 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'configures neutron ovs agent service' do
is_expected.to contain_service('neutron-ovs-agent-service').with(
should contain_service('neutron-ovs-agent-service').with(
:name => platform_params[:ovs_agent_service],
:enable => true,
:ensure => 'running',
:tag => ['neutron-service', 'neutron-db-sync-service'],
)
is_expected.to contain_service('neutron-ovs-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-ovs-agent-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-ovs-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-ovs-agent-service').that_notifies('Anchor[neutron::service::end]')
end
context 'with manage_service as false' do
@ -88,7 +88,7 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-ovs-agent-service').without_ensure
should contain_service('neutron-ovs-agent-service').without_ensure
end
end
@ -97,7 +97,7 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:firewall_driver => false)
end
it 'should configure firewall driver' do
is_expected.to contain_neutron_agent_ovs('securitygroup/firewall_driver').with_ensure('absent')
should contain_neutron_agent_ovs('securitygroup/firewall_driver').with_ensure('absent')
end
end
@ -106,7 +106,7 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:enable_security_group => false)
end
it 'should disable securitygroups' do
is_expected.to contain_neutron_agent_ovs('securitygroup/enable_security_group').with_value('false')
should contain_neutron_agent_ovs('securitygroup/enable_security_group').with_value('false')
end
end
@ -116,7 +116,7 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:arp_responder => true)
end
it 'should enable ARP responder' do
is_expected.to contain_neutron_agent_ovs('agent/arp_responder').with_value(true)
should contain_neutron_agent_ovs('agent/arp_responder').with_value(true)
end
end
@ -126,7 +126,7 @@ describe 'neutron::agents::ml2::ovs' do
:l2_population => true )
end
it 'should enable DVR' do
is_expected.to contain_neutron_agent_ovs('agent/enable_distributed_routing').with_value(true)
should contain_neutron_agent_ovs('agent/enable_distributed_routing').with_value(true)
end
end
@ -136,21 +136,21 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'should require vswitch::ovs' do
is_expected.to contain_class('vswitch::ovs')
should contain_class('vswitch::ovs')
end
it 'configures bridge mappings' do
is_expected.to contain_neutron_agent_ovs('ovs/bridge_mappings')
should contain_neutron_agent_ovs('ovs/bridge_mappings')
end
it 'should configure bridge mappings' do
is_expected.to contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with(
should contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with(
:before => 'Service[neutron-ovs-agent-service]'
)
end
it 'should configure bridge uplinks' do
is_expected.to contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with(
should contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with(
:before => 'Service[neutron-ovs-agent-service]'
)
end
@ -162,21 +162,21 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'should not require vswitch::ovs' do
is_expected.not_to contain_class('vswitch::ovs')
should_not contain_class('vswitch::ovs')
end
it 'configures bridge mappings' do
is_expected.to contain_neutron_agent_ovs('ovs/bridge_mappings')
should contain_neutron_agent_ovs('ovs/bridge_mappings')
end
it 'should not configure bridge mappings' do
is_expected.not_to contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with(
should_not contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with(
:before => 'Service[neutron-ovs-agent-service]'
)
end
it 'should not configure bridge uplinks' do
is_expected.not_to contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with(
should_not contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with(
:before => 'Service[neutron-ovs-agent-service]'
)
end
@ -188,7 +188,7 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'configures extensions' do
is_expected.to contain_neutron_agent_ovs('agent/extensions').with_value(params[:extensions].join(','))
should contain_neutron_agent_ovs('agent/extensions').with_value(params[:extensions].join(','))
end
end
@ -198,8 +198,8 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'configures ovs for DPDK' do
is_expected.to contain_neutron_agent_ovs('ovs/datapath_type').with_value(params[:datapath_type])
is_expected.to contain_neutron_agent_ovs('ovs/vhostuser_socket_dir').with_value(params[:vhostuser_socket_dir])
should contain_neutron_agent_ovs('ovs/datapath_type').with_value(params[:datapath_type])
should contain_neutron_agent_ovs('ovs/vhostuser_socket_dir').with_value(params[:vhostuser_socket_dir])
end
end
@ -209,17 +209,17 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:tunnel_types => ['vxlan'])
end
it_raises 'a Puppet::Error', /Local ip for ovs agent must be set when tunneling is enabled/
it { should raise_error(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!(:tunnel_types => ['vxlan'], :local_ip => '127.0.0.1' )
end
it 'should configure ovs for tunneling' do
is_expected.to contain_neutron_agent_ovs('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge])
is_expected.to contain_neutron_agent_ovs('ovs/local_ip').with_value('127.0.0.1')
is_expected.to contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_ovs('ovs/tun_peer_patch_port').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge])
should contain_neutron_agent_ovs('ovs/local_ip').with_value('127.0.0.1')
should contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/tun_peer_patch_port').with_value('<SERVICE DEFAULT>')
end
end
@ -231,8 +231,8 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'should perform vxlan network configuration' do
is_expected.to contain_neutron_agent_ovs('agent/tunnel_types').with_value(params[:tunnel_types])
is_expected.to contain_neutron_agent_ovs('agent/vxlan_udp_port').with_value(params[:vxlan_udp_port])
should contain_neutron_agent_ovs('agent/tunnel_types').with_value(params[:tunnel_types])
should contain_neutron_agent_ovs('agent/vxlan_udp_port').with_value(params[:vxlan_udp_port])
end
end
@ -244,7 +244,7 @@ describe 'neutron::agents::ml2::ovs' do
:local_ip => '127.0.0.1' )
end
it_raises 'a Puppet::Error', /L2 population must be enabled when DVR and tunneling are enabled/
it { should raise_error(Puppet::Error, /L2 population must be enabled when DVR and tunneling are enabled/) }
end
context 'when DVR is enabled and l2 population and tunneling are disabled' do
@ -255,8 +255,8 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'should enable DVR without L2 population' do
is_expected.to contain_neutron_agent_ovs('agent/enable_distributed_routing').with_value(true)
is_expected.to contain_neutron_agent_ovs('agent/l2_population').with_value(false)
should contain_neutron_agent_ovs('agent/enable_distributed_routing').with_value(true)
should contain_neutron_agent_ovs('agent/l2_population').with_value(false)
end
end
end
@ -266,7 +266,8 @@ describe 'neutron::agents::ml2::ovs' do
before :each do
params.merge!(:ovsdb_interface => 'random')
end
it_raises 'a Puppet::Error', /A value of \$ovsdb_interface is incorrect. The allowed values are vsctl and native/
it { should raise_error(Puppet::Error, /A value of \$ovsdb_interface is incorrect. The allowed values are vsctl and native/) }
end
context 'with supported value' do
@ -274,7 +275,7 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:ovsdb_interface => 'native')
end
it 'should configure ovsdb_interface for ovs' do
is_expected.to contain_neutron_agent_ovs('ovs/ovsdb_interface').with_value('native')
should contain_neutron_agent_ovs('ovs/ovsdb_interface').with_value('native')
end
end
end
@ -284,26 +285,26 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:enable_dpdk => true, :manage_vswitch => false)
end
it_raises 'a Puppet::Error',/Enabling DPDK without manage vswitch does not have any effect/
it { should raise_error(Puppet::Error, /Enabling DPDK without manage vswitch does not have any effect/) }
end
end
shared_examples_for 'neutron::agents::ml2::ovs on Debian' do
shared_examples 'neutron::agents::ml2::ovs on Debian' do
# placeholder for debian specific tests
end
shared_examples_for 'neutron::agents::ml2::ovs on RedHat' do
shared_examples 'neutron::agents::ml2::ovs on RedHat' do
it 'configures neutron ovs cleanup service' do
is_expected.to contain_service('ovs-cleanup-service').with(
should contain_service('ovs-cleanup-service').with(
:name => platform_params[:ovs_cleanup_service],
:enable => true
).that_requires('Anchor[neutron::install::end]')
is_expected.to contain_package('neutron-ovs-agent').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron-ovs-agent').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron-ovs-agent').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron-ovs-agent').that_notifies('Anchor[neutron::install::end]')
end
it 'configures neutron destroy patch ports service' do
is_expected.to contain_service('neutron-destroy-patch-ports-service').with(
should contain_service('neutron-destroy-patch-ports-service').with(
:name => platform_params[:destroy_patch_ports_service],
:enable => true,
:ensure => 'running',
@ -322,7 +323,7 @@ describe 'neutron::agents::ml2::ovs' do
end
it 'should require vswitch::dpdk' do
is_expected.to contain_class('vswitch::dpdk')
should contain_class('vswitch::dpdk')
end
end

View File

@ -1,24 +1,18 @@
require 'spec_helper'
describe 'neutron::agents::ml2::sriov' do
let :pre_condition do
"class { 'neutron': }"
end
let :default_params do
{ :package_ensure => 'present',
:enabled => true,
:manage_service => true,
:polling_interval => 2,
:supported_pci_vendor_devs => [],
:purge_config => false,
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
{
:package_ensure => 'present',
:enabled => true,
:manage_service => true,
:polling_interval => 2,
:supported_pci_vendor_devs => [],
:purge_config => false,
}
end
@ -26,50 +20,50 @@ describe 'neutron::agents::ml2::sriov' do
{}
end
shared_examples_for 'neutron sriov-nic agent with ml2 plugin' do
shared_examples 'neutron sriov-nic agent with ml2 plugin' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_sriov_agent_config').with({
should contain_resources('neutron_sriov_agent_config').with({
:purge => false
})
end
it 'configures /etc/neutron/plugins/ml2/sriov_agent.ini' do
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/polling_interval').with_value(p[:polling_interval])
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_sriov_agent_config('agent/extensions').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_sriov_agent_config('securitygroup/firewall_driver').with_value('noop')
should contain_neutron_sriov_agent_config('sriov_nic/polling_interval').with_value(p[:polling_interval])
should contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value('<SERVICE DEFAULT>')
should contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value('<SERVICE DEFAULT>')
should contain_neutron_sriov_agent_config('agent/extensions').with_value(['<SERVICE DEFAULT>'])
should contain_neutron_sriov_agent_config('securitygroup/firewall_driver').with_value('noop')
end
it 'does not configure numvfs by default' do
is_expected.not_to contain_neutron_agents_ml2_sriov_numvfs('<SERVICE DEFAULT>')
should_not contain_neutron_agents_ml2_sriov_numvfs('<SERVICE DEFAULT>')
end
it 'installs neutron sriov-nic agent package' do
is_expected.to contain_package('neutron-sriov-nic-agent').with(
should contain_package('neutron-sriov-nic-agent').with(
:name => platform_params[:sriov_nic_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-sriov-nic-agent').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron-sriov-nic-agent').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron-sriov-nic-agent').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron-sriov-nic-agent').that_notifies('Anchor[neutron::install::end]')
end
it 'configures neutron sriov agent service' do
is_expected.to contain_service('neutron-sriov-nic-agent-service').with(
should contain_service('neutron-sriov-nic-agent-service').with(
:name => platform_params[:sriov_nic_agent_service],
:enable => true,
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('neutron-sriov-nic-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-sriov-nic-agent-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-sriov-nic-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-sriov-nic-agent-service').that_notifies('Anchor[neutron::service::end]')
end
context 'when number_of_vfs is empty' do
@ -78,7 +72,7 @@ describe 'neutron::agents::ml2::sriov' do
end
it 'does not configure numvfs ' do
is_expected.not_to contain_neutron_agents_ml2_sriov_numvfs('<SERVICE DEFAULT>')
should_not contain_neutron_agents_ml2_sriov_numvfs('<SERVICE DEFAULT>')
end
end
@ -88,8 +82,8 @@ describe 'neutron::agents::ml2::sriov' do
end
it 'configures numvfs' do
is_expected.to contain_neutron_agent_sriov_numvfs('eth0:4').with( :ensure => 'present' )
is_expected.to contain_neutron_agent_sriov_numvfs('eth1:5').with( :ensure => 'present')
should contain_neutron_agent_sriov_numvfs('eth0:4').with( :ensure => 'present' )
should contain_neutron_agent_sriov_numvfs('eth1:5').with( :ensure => 'present')
end
end
@ -98,7 +92,7 @@ describe 'neutron::agents::ml2::sriov' do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-sriov-nic-agent-service').without_ensure
should contain_service('neutron-sriov-nic-agent-service').without_ensure
end
end
@ -109,8 +103,8 @@ describe 'neutron::agents::ml2::sriov' do
end
it 'configures physical device mappings with exclusion' do
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value(['physnet1:eth2'])
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value(['physnet1:eth1'])
should contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value(['physnet1:eth2'])
should contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value(['physnet1:eth1'])
end
end
@ -121,8 +115,8 @@ describe 'neutron::agents::ml2::sriov' do
end
it 'configures physical device mappings with exclusion' do
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value('<SERVICE DEFAULT>')
should contain_neutron_sriov_agent_config('sriov_nic/exclude_devices').with_value('<SERVICE DEFAULT>')
should contain_neutron_sriov_agent_config('sriov_nic/physical_device_mappings').with_value('<SERVICE DEFAULT>')
end
end
@ -132,41 +126,35 @@ describe 'neutron::agents::ml2::sriov' do
end
it 'configures extensions' do
is_expected.to contain_neutron_sriov_agent_config('agent/extensions').with_value(params[:extensions].join(','))
should contain_neutron_sriov_agent_config('agent/extensions').with_value(params[:extensions].join(','))
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:sriov_nic_agent_package => 'neutron-sriov-agent',
:sriov_nic_agent_service => 'neutron-sriov-agent'
}
when 'RedHat'
{
:sriov_nic_agent_package => 'openstack-neutron-sriov-nic-agent',
:sriov_nic_agent_service => 'neutron-sriov-nic-agent'
}
end
end
it_behaves_like 'neutron sriov-nic agent with ml2 plugin'
end
let :platform_params do
{ :sriov_nic_agent_package => 'neutron-sriov-agent',
:sriov_nic_agent_service => 'neutron-sriov-agent' }
end
it_configures 'neutron sriov-nic agent with ml2 plugin'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
let :platform_params do
{ :sriov_nic_agent_package => 'openstack-neutron-sriov-nic-agent',
:sriov_nic_agent_service => 'neutron-sriov-nic-agent' }
end
it_configures 'neutron sriov-nic agent with ml2 plugin'
end
end

View File

@ -18,27 +18,27 @@ describe 'neutron::agents::ml2::vpp' do
{}
end
shared_examples_for 'neutron plugin vpp agent with ml2 plugin' do
shared_examples 'neutron plugin vpp agent with ml2 plugin' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_agent_vpp').with({
should contain_resources('neutron_agent_vpp').with({
:purge => false
})
end
it 'configures plugins/ml2/vpp_agent.ini' do
is_expected.to contain_neutron_agent_vpp('ml2_vpp/physnets').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_vpp('ml2_vpp/etcd_user').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_vpp('ml2_vpp/etcd_pass').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_vpp('ml2_vpp/physnets').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_vpp('ml2_vpp/etcd_user').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_vpp('ml2_vpp/etcd_pass').with_value('<SERVICE DEFAULT>')
end
it 'installs neutron vpp agent package' do
is_expected.to contain_package('neutron-vpp-agent').with(
should contain_package('neutron-vpp-agent').with(
:name => platform_params[:vpp_plugin_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
@ -46,14 +46,14 @@ describe 'neutron::agents::ml2::vpp' do
end
it 'configures neutron vpp agent service' do
is_expected.to contain_service('neutron-vpp-agent-service').with(
should contain_service('neutron-vpp-agent-service').with(
:name => platform_params[:vpp_agent_service],
:enable => true,
:ensure => 'running',
:tag => ['neutron-service'],
)
is_expected.to contain_service('neutron-vpp-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-vpp-agent-service').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-vpp-agent-service').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-vpp-agent-service').that_notifies('Anchor[neutron::service::end]')
end
context 'with manage_service as false' do
@ -61,7 +61,7 @@ describe 'neutron::agents::ml2::vpp' do
params.merge!(:manage_service => false)
end
it 'should not start/stop service' do
is_expected.to contain_service('neutron-vpp-agent-service').without_ensure
should contain_service('neutron-vpp-agent-service').without_ensure
end
end
@ -70,7 +70,7 @@ describe 'neutron::agents::ml2::vpp' do
params.merge!(:physnets => 'physnet:GigabitEthernet2/2/0')
end
it 'should configure physnets' do
is_expected.to contain_neutron_agent_vpp('ml2_vpp/physnets').with_value('physnet:GigabitEthernet2/2/0')
should contain_neutron_agent_vpp('ml2_vpp/physnets').with_value('physnet:GigabitEthernet2/2/0')
end
end
@ -80,8 +80,8 @@ describe 'neutron::agents::ml2::vpp' do
:etcd_pass => 'password' )
end
it 'should configure etcd username and password' do
is_expected.to contain_neutron_agent_vpp('ml2_vpp/etcd_user').with_value('admin')
is_expected.to contain_neutron_agent_vpp('ml2_vpp/etcd_pass').with_value('password')
should contain_neutron_agent_vpp('ml2_vpp/etcd_user').with_value('admin')
should contain_neutron_agent_vpp('ml2_vpp/etcd_pass').with_value('password')
end
end
end

View File

@ -1,246 +1,260 @@
require 'spec_helper'
describe 'neutron::agents::n1kv_vem' do
let :facts do
OSDefaults.get_facts({
:operatingsystem => 'RedHat',
:operatingsystemrelease => '7',
:osfamily => 'RedHat',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
})
end
it 'should have a n1kv-vem config file' do
is_expected.to contain_file('/etc/n1kv/n1kv.conf').with(
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0664'
)
end
it 'install n1kv-vem' do
is_expected.to contain_service('openvswitch').with_notify(['Package[nexus1000v]'])
is_expected.to contain_package('nexus1000v').with_notify(['Service[nexus1000v]'])
is_expected.to contain_service('nexus1000v').with_ensure('running')
end
context 'with local file vem rpm' do
let :params do
{
:n1kv_source => 'vem.rpm'
}
end
it 'verify dependency' do
is_expected.to contain_package('nexus1000v').with_source('/var/n1kv/vem.rpm')
is_expected.to contain_file('/var/n1kv/vem.rpm').that_requires('File[/var/n1kv]')
is_expected.to contain_file('/var/n1kv/vem.rpm').with(
shared_examples 'neutron::agents::n1kv_vem' do
it 'should have a n1kv-vem config file' do
should contain_file('/etc/n1kv/n1kv.conf').with(
:ensure => 'present',
:owner => 'root',
:group => 'root',
:mode => '0664'
)
end
it 'install n1kv-vem' do
should contain_service('openvswitch').with_notify(['Package[nexus1000v]'])
should contain_package('nexus1000v').with_notify(['Service[nexus1000v]'])
should contain_service('nexus1000v').with_ensure('running')
end
context 'with local file vem rpm' do
let :params do
{
:n1kv_source => 'vem.rpm'
}
end
it 'verify dependency' do
should contain_package('nexus1000v').with_source('/var/n1kv/vem.rpm')
should contain_file('/var/n1kv/vem.rpm').that_requires('File[/var/n1kv]')
should contain_file('/var/n1kv/vem.rpm').with(
:owner => 'root',
:group => 'root',
:mode => '0664'
)
end
end
context 'remote vem rpm' do
let :params do
{
:n1kv_source => 'http://www.cisco.com/repo'
}
end
it 'verify dependency' do
should contain_package('nexus1000v').without_source
should contain_yumrepo('cisco-vem-repo').with(
:baseurl => 'http://www.cisco.com/repo',
:enabled => 1
)
end
end
it 'execute reread config upon config change' do
should contain_exec('vemcmd reread config') \
.that_subscribes_to('File[/etc/n1kv/n1kv.conf]')
end
context 'verify n1kv.conf default' do
let :params do
{
:n1kv_vsm_ip => '9.0.0.1',
:n1kv_vsm_ipv6 => '::3',
:n1kv_vsm_domain_id => 900,
:host_mgmt_intf => 'eth9',
:portdb => 'ovs',
:fastpath_flood => 'enable'
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^l3control-ipaddr 9.0.0.1/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^l3control-ipv6addr ::3/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^switch-domain 900/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^host-mgmt-intf eth9/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^portdb ovs/)
should contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^phys/)
should contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^virt/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^node-type compute/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^fastpath-flood enable/)
end
end
context 'verify n1kv.conf svs-mode with default IPv6 address' do
let :params do
{
:n1kv_vsm_ipv6 => '::1'
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^svs-mode V6/)
end
end
context 'verify n1kv.conf svs-mode with non-default IPv6 address' do
let :params do
{
:n1kv_vsm_ipv6 => '::3'
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^svs-mode V6/)
end
end
context 'verify node_type' do
let :params do
{
:node_type => 'network',
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^node-type network/)
should contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^node-type compute/)
end
end
context 'verify portdb' do
let :params do
{
:portdb => 'vem',
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^portdb vem/)
should contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^portdb ovs/)
end
end
context 'verify fastpath_flood' do
let :params do
{
:fastpath_flood => 'disable',
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^fastpath-flood disable/)
should contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^fastpath-flood enable/)
end
end
context 'verify n1kv.conf with uplinks' do
let :params do
{
:uplink_profile => { 'eth1' => 'prof1',
'eth2' => 'prof2'
}
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^phys eth1 profile prof1/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^phys eth2 profile prof2/)
end
end
context 'verify n1kv.conf with vtep info' do
let :params do
{
:vtep_config => { 'vtep1' => { 'profile' => 'profint',
'ipmode' => 'dhcp'
},
'vtep2' => { 'profile' => 'profint',
'ipmode' => 'static',
'ipaddress' => '192.168.1.1',
'netmask' => '255.255.255.0'
}
}
}
end
it do
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^virt vtep1 profile profint mode dhcp/)
should contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^virt vtep2 profile profint mode static/)
end
end
context 'with manage_service as false' do
let :params do
{
:manage_service => false
}
end
it 'should not start/stop service' do
should contain_service('nexus1000v').without_ensure
end
end
context 'with manage_service true and enable_service false' do
let :params do
{
:manage_service => true,
:enable => false
}
end
it 'should stop service' do
should contain_service('nexus1000v').with_ensure('stopped')
end
end
context 'verify sysctl setting with vteps_in_same_subnet true' do
let :params do
{
:vteps_in_same_subnet => true
}
end
it do
should contain_sysctl__value('net.ipv4.conf.default.rp_filter').with_value('2')
should contain_sysctl__value('net.ipv4.conf.all.rp_filter').with_value('2')
should contain_sysctl__value('net.ipv4.conf.default.arp_ignore').with_value('1')
should contain_sysctl__value('net.ipv4.conf.all.arp_ignore').with_value('1')
should contain_sysctl__value('net.ipv4.conf.all.arp_announce').with_value('2')
should contain_sysctl__value('net.ipv4.conf.default.arp_announce').with_value('2')
end
end
end
context 'remote vem rpm' do
let :params do
{
:n1kv_source => 'http://www.cisco.com/repo'
}
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 'verify dependency' do
is_expected.to contain_package('nexus1000v').without_source
is_expected.to contain_yumrepo('cisco-vem-repo').with(
:baseurl => 'http://www.cisco.com/repo',
:enabled => 1
)
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron::agents::n1kv_vem'
end
end
end
it 'execute reread config upon config change' do
is_expected.to contain_exec('vemcmd reread config') \
.that_subscribes_to('File[/etc/n1kv/n1kv.conf]')
end
context 'verify n1kv.conf default' do
let :params do
{
:n1kv_vsm_ip => '9.0.0.1',
:n1kv_vsm_ipv6 => '::3',
:n1kv_vsm_domain_id => 900,
:host_mgmt_intf => 'eth9',
:portdb => 'ovs',
:fastpath_flood => 'enable'
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^l3control-ipaddr 9.0.0.1/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^l3control-ipv6addr ::3/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^switch-domain 900/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^host-mgmt-intf eth9/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^portdb ovs/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^phys/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^virt/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^node-type compute/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^fastpath-flood enable/)
end
end
context 'verify n1kv.conf svs-mode with default IPv6 address' do
let :params do
{
:n1kv_vsm_ipv6 => '::1'
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^svs-mode V6/)
end
end
context 'verify n1kv.conf svs-mode with non-default IPv6 address' do
let :params do
{
:n1kv_vsm_ipv6 => '::3'
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^svs-mode V6/)
end
end
context 'verify node_type' do
let :params do
{
:node_type => 'network',
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^node-type network/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^node-type compute/)
end
end
context 'verify portdb' do
let :params do
{
:portdb => 'vem',
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^portdb vem/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^portdb ovs/)
end
end
context 'verify fastpath_flood' do
let :params do
{
:fastpath_flood => 'disable',
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^fastpath-flood disable/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.without_content(/^fastpath-flood enable/)
end
end
context 'verify n1kv.conf with uplinks' do
let :params do
{
:uplink_profile => { 'eth1' => 'prof1',
'eth2' => 'prof2'
}
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^phys eth1 profile prof1/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^phys eth2 profile prof2/)
end
end
context 'verify n1kv.conf with vtep info' do
let :params do
{
:vtep_config => { 'vtep1' => { 'profile' => 'profint',
'ipmode' => 'dhcp'
},
'vtep2' => { 'profile' => 'profint',
'ipmode' => 'static',
'ipaddress' => '192.168.1.1',
'netmask' => '255.255.255.0'
}
}
}
end
it do
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^virt vtep1 profile profint mode dhcp/)
is_expected.to contain_file('/etc/n1kv/n1kv.conf') \
.with_content(/^virt vtep2 profile profint mode static/)
end
end
context 'with manage_service as false' do
let :params do
{
:manage_service => false
}
end
it 'should not start/stop service' do
is_expected.to contain_service('nexus1000v').without_ensure
end
end
context 'with manage_service true and enable_service false' do
let :params do
{
:manage_service => true,
:enable => false
}
end
it 'should stop service' do
is_expected.to contain_service('nexus1000v').with_ensure('stopped')
end
end
context 'verify sysctl setting with vteps_in_same_subnet true' do
let :params do
{
:vteps_in_same_subnet => true
}
end
it do
is_expected.to contain_sysctl__value('net.ipv4.conf.default.rp_filter').with_value('2')
is_expected.to contain_sysctl__value('net.ipv4.conf.all.rp_filter').with_value('2')
is_expected.to contain_sysctl__value('net.ipv4.conf.default.arp_ignore').with_value('1')
is_expected.to contain_sysctl__value('net.ipv4.conf.all.arp_ignore').with_value('1')
is_expected.to contain_sysctl__value('net.ipv4.conf.all.arp_announce').with_value('2')
is_expected.to contain_sysctl__value('net.ipv4.conf.default.arp_announce').with_value('2')
end
end
end

View File

@ -1,84 +1,79 @@
require 'spec_helper'
describe 'neutron::agents::ovn_metadata' do
let :pre_condition do
"class { 'neutron': }"
end
let :params do
{ :package_ensure => 'present',
:debug => false,
:enabled => true,
:shared_secret => 'metadata-secret',
:purge_config => false,
:ovsdb_connection => 'tcp:127.0.0.1:6640',
:root_helper => 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
:state_path => '/var/lib/neutron/',
{
:package_ensure => 'present',
:debug => false,
:enabled => true,
:shared_secret => 'metadata-secret',
:purge_config => false,
:ovsdb_connection => 'tcp:127.0.0.1:6640',
:root_helper => 'sudo neutron-rootwrap /etc/neutron/rootwrap.conf',
:state_path => '/var/lib/neutron/',
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'ovn metadata agent' do
it { is_expected.to contain_class('neutron::params') }
shared_examples 'ovn metadata agent' do
it { should contain_class('neutron::params') }
it 'configures ovn metadata agent service' do
is_expected.to contain_service('ovn-metadata').with(
should contain_service('ovn-metadata').with(
:name => platform_params[:ovn_metadata_agent_service],
:enable => params[:enabled],
:ensure => 'running',
:tag => 'neutron-service',
)
is_expected.to contain_service('ovn-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('ovn-metadata').that_notifies('Anchor[neutron::service::end]')
should contain_service('ovn-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('ovn-metadata').that_notifies('Anchor[neutron::service::end]')
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('ovn-metadata').without_ensure
should contain_service('ovn-metadata').without_ensure
end
end
it 'passes purge to resource' do
is_expected.to contain_resources('ovn_metadata_agent_config').with({
should contain_resources('ovn_metadata_agent_config').with({
:purge => false
})
end
it 'configures ovn_metadata_agent.ini' do
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/debug').with(:value => params[:debug])
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/auth_ca_cert').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_client_cert').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_client_priv_key').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_ip').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_host').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_port').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_protocol').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:os_workers])
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_insecure').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/state_path').with(:value => params[:state_path])
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/metadata_proxy_shared_secret').with(:value => params[:shared_secret])
is_expected.to contain_ovn_metadata_agent_config('agent/root_helper').with(:value => params[:root_helper])
is_expected.to contain_ovn_metadata_agent_config('agent/root_helper_daemon').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('ovs/ovsdb_connection_timeout').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_ovn_metadata_agent_config('ovs/ovsdb_connection').with(:value => params[:ovsdb_connection])
is_expected.to contain_ovn_metadata_agent_config('ovn/ovn_sb_connection').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/debug').with(:value => params[:debug])
should contain_ovn_metadata_agent_config('DEFAULT/auth_ca_cert').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/nova_client_cert').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/nova_client_priv_key').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_ip').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_host').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_port').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_protocol').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:os_workers])
should contain_ovn_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_insecure').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('DEFAULT/state_path').with(:value => params[:state_path])
should contain_ovn_metadata_agent_config('DEFAULT/metadata_proxy_shared_secret').with(:value => params[:shared_secret])
should contain_ovn_metadata_agent_config('agent/root_helper').with(:value => params[:root_helper])
should contain_ovn_metadata_agent_config('agent/root_helper_daemon').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('ovs/ovsdb_connection_timeout').with(:value => '<SERVICE DEFAULT>')
should contain_ovn_metadata_agent_config('ovs/ovsdb_connection').with(:value => params[:ovsdb_connection])
should contain_ovn_metadata_agent_config('ovn/ovn_sb_connection').with(:value => '<SERVICE DEFAULT>')
end
end
shared_examples_for 'ovn metadata agent with auth_ca_cert set' do
shared_examples 'ovn metadata agent with auth_ca_cert set' do
let :params do
{ :auth_ca_cert => '/some/cert',
{
:auth_ca_cert => '/some/cert',
:shared_secret => '42',
:nova_client_cert => '/nova/cert',
:nova_client_priv_key => '/nova/key',
@ -87,56 +82,56 @@ describe 'neutron::agents::ovn_metadata' do
end
it 'configures certificate' do
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/auth_ca_cert').with_value('/some/cert')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_client_cert').with_value('/nova/cert')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_client_priv_key').with_value('/nova/key')
is_expected.to contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_insecure').with_value(true)
should contain_ovn_metadata_agent_config('DEFAULT/auth_ca_cert').with_value('/some/cert')
should contain_ovn_metadata_agent_config('DEFAULT/nova_client_cert').with_value('/nova/cert')
should contain_ovn_metadata_agent_config('DEFAULT/nova_client_priv_key').with_value('/nova/key')
should contain_ovn_metadata_agent_config('DEFAULT/nova_metadata_insecure').with_value(true)
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } } }
))
end
let :platform_params do
{ :ovn_metadata_agent_service => 'networking-ovn-metadata-agent' }
end
it_configures 'ovn metadata agent'
it_configures 'ovn metadata agent with auth_ca_cert set'
end
context 'on Red Hat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
let :platform_params do
{ :ovn_metadata_agent_package => 'python-networking-ovn-metadata-agent',
:ovn_metadata_agent_service => 'networking-ovn-metadata-agent' }
end
shared_examples 'neutron::agents::ovn::metadata on RedHat based' do
it 'installs ovn metadata agent package' do
is_expected.to contain_package('ovn-metadata').with(
should contain_package('ovn-metadata').with(
:ensure => params[:package_ensure],
:name => platform_params[:ovn_metadata_agent_package],
:tag => ['openstack', 'neutron-package'],
)
end
it_configures 'ovn metadata agent'
it_configures 'ovn metadata agent with auth_ca_cert set'
it 'configures subscription to ovn-metadata package' do
is_expected.to contain_service('ovn-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('ovn-metadata').that_notifies('Anchor[neutron::service::end]')
should contain_service('ovn-metadata').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('ovn-metadata').that_notifies('Anchor[neutron::service::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
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:ovn_metadata_agent_service => 'networking-ovn-metadata-agent'
}
when 'RedHat'
{
:ovn_metadata_agent_package => 'python-networking-ovn-metadata-agent',
:ovn_metadata_agent_service => 'networking-ovn-metadata-agent'
}
end
end
it_behaves_like 'ovn metadata agent'
it_behaves_like 'ovn metadata agent with auth_ca_cert set'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron::agents::ovn::metadata on RedHat based'
end
end
end
end

View File

@ -21,7 +21,6 @@
require 'spec_helper'
describe 'neutron::agents::vpnaas' do
let :pre_condition do
"class { 'neutron': }"
end
@ -31,141 +30,121 @@ describe 'neutron::agents::vpnaas' do
end
let :default_params do
{ :package_ensure => 'present',
:vpn_device_driver => 'neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver',
:interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
:purge_config => false,
{
:package_ensure => 'present',
:vpn_device_driver => 'neutron.services.vpn.device_drivers.ipsec.OpenSwanDriver',
:interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
:purge_config => false,
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron vpnaas agent' do
shared_examples 'neutron vpnaas agent' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it_configures 'openswan vpnaas_driver'
it_behaves_like 'openswan vpnaas_driver'
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_vpnaas_agent_config').with({
should contain_resources('neutron_vpnaas_agent_config').with({
:purge => false
})
end
it 'configures vpnaas_agent.ini' do
is_expected.to contain_neutron_vpnaas_agent_config('vpnagent/vpn_device_driver').with_value(p[:vpn_device_driver]);
is_expected.to contain_neutron_vpnaas_agent_config('ipsec/ipsec_status_check_interval').with_value('<SERVICE DEFAULT>');
is_expected.to contain_neutron_vpnaas_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
should contain_neutron_vpnaas_agent_config('vpnagent/vpn_device_driver').with_value(p[:vpn_device_driver]);
should contain_neutron_vpnaas_agent_config('ipsec/ipsec_status_check_interval').with_value('<SERVICE DEFAULT>');
should contain_neutron_vpnaas_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver]);
end
it 'installs neutron vpnaas agent package' do
if platform_params.has_key?(:vpnaas_agent_package)
is_expected.to contain_package('neutron-vpnaas-agent').with(
should contain_package('neutron-vpnaas-agent').with(
:name => platform_params[:vpnaas_agent_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
end
end
end
shared_examples_for 'openswan vpnaas_driver' do
shared_examples 'openswan vpnaas_driver' do
it 'installs openswan packages' do
if platform_params.has_key?(:vpnaas_agent_package)
is_expected.to contain_package('openswan')
should contain_package('openswan')
end
is_expected.to contain_package('openswan').with(
should contain_package('openswan').with(
:ensure => 'present',
:name => platform_params[:openswan_package]
)
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
let :platform_params do
{ :openswan_package => 'openswan',
:vpnaas_agent_package => 'neutron-vpn-agent'}
end
it_configures 'neutron vpnaas agent'
shared_examples 'neutron::agents::vpnaas on Debian' do
context 'when configuring the LibreSwan driver' do
before do
params.merge!(
:vpn_device_driver => 'neutron_vpnaas.services.vpn.device_drivers.libreswan_ipsec.LibreSwanDriver'
)
params.merge!(
:vpn_device_driver => 'neutron_vpnaas.services.vpn.device_drivers.libreswan_ipsec.LibreSwanDriver'
)
end
it 'fails when configuring LibreSwan on Debian' do
is_expected.to raise_error(Puppet::Error, /LibreSwan is not supported on osfamily Debian/)
should raise_error(Puppet::Error, /LibreSwan is not supported on osfamily Debian/)
end
end
end
context 'on RedHat 6 platforms' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'RedHat',
:operatingsystemrelease => '6.5',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '6', :minor => '5' } },
:operatingsystemmajrelease => 6 }))
end
let :platform_params do
{ :openswan_package => 'openswan',
:vpnaas_agent_package => 'openstack-neutron-vpnaas'}
end
it_configures 'neutron vpnaas agent'
end
context 'on RedHat 7 platforms' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'RedHat',
:operatingsystemrelease => '7.1.2',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '1.2' } },
:operatingsystemmajrelease => 7 }))
end
let :platform_params do
{ :openswan_package => 'libreswan',
:libreswan_package => 'libreswan',
:vpnaas_agent_package => 'openstack-neutron-vpnaas'}
end
it_configures 'neutron vpnaas agent'
shared_examples 'neutron::agents::vpnaas on RedHat' do
context 'when configuring the LibreSwan driver' do
before do
params.merge!(
:vpn_device_driver => 'neutron_vpnaas.services.vpn.device_drivers.libreswan_ipsec.LibreSwanDriver'
)
params.merge!(
:vpn_device_driver => 'neutron_vpnaas.services.vpn.device_drivers.libreswan_ipsec.LibreSwanDriver'
)
end
it 'configures LibreSwan' do
is_expected.to contain_neutron_vpnaas_agent_config('vpnagent/vpn_device_driver').with_value(params[:vpn_device_driver]);
is_expected.to contain_package('libreswan').with(
should contain_neutron_vpnaas_agent_config('vpnagent/vpn_device_driver').with_value(params[:vpn_device_driver]);
should contain_package('libreswan').with(
:ensure => 'present',
:name => platform_params[:libreswan_package]
)
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
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:openswan_package => 'openswan',
:vpnaas_agent_package => 'neutron-vpn-agent'
}
when 'RedHat'
{
:openswan_package => 'libreswan',
:libreswan_package => 'libreswan',
:vpnaas_agent_package => 'openstack-neutron-vpnaas'
}
end
end
it_behaves_like "neutron::agents::vpnaas on #{facts[:osfamily]}"
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron vpnaas agent'
end
end
end
end

View File

@ -1,14 +1,12 @@
require 'spec_helper'
describe 'neutron::client' do
shared_examples_for 'neutron client' do
it { is_expected.to contain_class('neutron::deps') }
it { is_expected.to contain_class('neutron::params') }
shared_examples 'neutron client' do
it { should contain_class('neutron::deps') }
it { should contain_class('neutron::params') }
it 'installs neutron client package' do
is_expected.to contain_package('python-neutronclient').with(
should contain_package('python-neutronclient').with(
:ensure => 'present',
:name => platform_params[:client_package],
:tag => ['neutron-support-package', 'openstack']
@ -40,5 +38,4 @@ describe 'neutron::client' do
it_behaves_like 'neutron client'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::config' do
let(:config_hash) do {
'DEFAULT/foo' => { 'value' => 'fooValue' },
'DEFAULT/bar' => { 'value' => 'barValue' },
@ -9,33 +8,33 @@ describe 'neutron::config' do
}
end
shared_examples_for 'neutron_config' do
shared_examples 'neutron_config' do
let :params do
{ :server_config => config_hash }
end
it { is_expected.to contain_class('neutron::deps') }
it { should contain_class('neutron::deps') }
it 'configures arbitrary neutron-config configurations' do
is_expected.to contain_neutron_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_config('DEFAULT/baz').with_ensure('absent')
end
end
shared_examples_for 'neutron_api_config' do
shared_examples 'neutron_api_config' do
let :params do
{ :api_config => config_hash }
end
it 'configures arbitrary neutron-api-config configurations' do
is_expected.to contain_neutron_api_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_api_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_api_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_api_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_api_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_api_config('DEFAULT/baz').with_ensure('absent')
end
end
shared_examples_for 'neutron_service_config' do
shared_examples 'neutron_service_config' do
let :params do
{ :sfc_service_config => config_hash,
:l2gw_service_config => config_hash,
@ -43,19 +42,19 @@ describe 'neutron::config' do
end
it 'configures arbitrary sfc_service_config configurations' do
is_expected.to contain_neutron_sfc_service_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_sfc_service_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_sfc_service_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_sfc_service_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_sfc_service_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_sfc_service_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary l2gw_service_config configurations' do
is_expected.to contain_neutron_l2gw_service_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_l2gw_service_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_l2gw_service_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_l2gw_service_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_l2gw_service_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_l2gw_service_config('DEFAULT/baz').with_ensure('absent')
end
end
shared_examples_for 'neutron_agent_config' do
shared_examples 'neutron_agent_config' do
let :params do
{ :l3_agent_config => config_hash,
:dhcp_agent_config => config_hash,
@ -69,56 +68,56 @@ describe 'neutron::config' do
end
it 'configures arbitrary l3_agent_config configurations' do
is_expected.to contain_neutron_l3_agent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_l3_agent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_l3_agent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_l3_agent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_l3_agent_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary dhcp_agent_config configurations' do
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_dhcp_agent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_dhcp_agent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_dhcp_agent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_dhcp_agent_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary lbaas_agent_config configurations' do
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_lbaas_agent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_lbaas_agent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_lbaas_agent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_lbaas_agent_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary metadata_agent_config configurations' do
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_metadata_agent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_metadata_agent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_metadata_agent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_metadata_agent_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary metering_agent_config configurations' do
is_expected.to contain_neutron_metering_agent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_metering_agent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_metering_agent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_metering_agent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_metering_agent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_metering_agent_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary vpnaas_agent_config configurations' do
is_expected.to contain_neutron_vpnaas_agent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_vpnaas_agent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_vpnaas_agent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_vpnaas_agent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_vpnaas_agent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_vpnaas_agent_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary l2gw_agent_config configurations' do
is_expected.to contain_neutron_l2gw_agent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_l2gw_agent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_l2gw_agent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_l2gw_agent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_l2gw_agent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_l2gw_agent_config('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary bgp_dragent_config configurations' do
is_expected.to contain_neutron_bgp_dragent_config('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_bgp_dragent_config('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_bgp_dragent_config('DEFAULT/baz').with_ensure('absent')
should contain_neutron_bgp_dragent_config('DEFAULT/foo').with_value('fooValue')
should contain_neutron_bgp_dragent_config('DEFAULT/bar').with_value('barValue')
should contain_neutron_bgp_dragent_config('DEFAULT/baz').with_ensure('absent')
end
end
shared_examples_for 'neutron_plugin_config' do
shared_examples 'neutron_plugin_config' do
let :params do
{
:plugin_linuxbridge_config => config_hash,
@ -136,69 +135,69 @@ describe 'neutron::config' do
end
it 'configures arbitrary neutron_plugin_linuxbridge configurations' do
is_expected.to contain_neutron_plugin_linuxbridge('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_linuxbridge('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_linuxbridge('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_linuxbridge('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_linuxbridge('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_linuxbridge('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_cisco_db_conn configurations' do
is_expected.to contain_neutron_plugin_cisco_db_conn('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_cisco_db_conn('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_cisco_db_conn('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_cisco_db_conn('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_cisco_db_conn('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_cisco_db_conn('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_cisco_l2network configurations' do
is_expected.to contain_neutron_plugin_cisco_l2network('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_cisco_l2network('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_cisco_l2network('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_cisco_l2network('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_cisco_l2network('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_cisco_l2network('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_cisco configurations' do
is_expected.to contain_neutron_plugin_cisco('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_cisco('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_cisco('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_cisco('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_cisco('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_cisco('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_midonet configurations' do
is_expected.to contain_neutron_plugin_midonet('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_midonet('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_midonet('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_midonet('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_midonet('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_midonet('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_plumgrid configurations' do
is_expected.to contain_neutron_plugin_plumgrid('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_plumgrid('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_plumgrid('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_plumgrid('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_plumgrid('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_plumgrid('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_nsx configurations' do
is_expected.to contain_neutron_plugin_nsx('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_nsx('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_nsx('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_nsx('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_nsx('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_nsx('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_nvp configurations' do
is_expected.to contain_neutron_plugin_nvp('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_nvp('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_nvp('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_nvp('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_nvp('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_nvp('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_opencontrail configurations' do
is_expected.to contain_neutron_plugin_opencontrail('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_opencontrail('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_opencontrail('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_opencontrail('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_opencontrail('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_opencontrail('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_nuage configurations' do
is_expected.to contain_neutron_plugin_nuage('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_nuage('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_nuage('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_nuage('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_nuage('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_nuage('DEFAULT/baz').with_ensure('absent')
end
it 'configures arbitrary neutron_plugin_ml2 configurations' do
is_expected.to contain_neutron_plugin_ml2('DEFAULT/foo').with_value('fooValue')
is_expected.to contain_neutron_plugin_ml2('DEFAULT/bar').with_value('barValue')
is_expected.to contain_neutron_plugin_ml2('DEFAULT/baz').with_ensure('absent')
should contain_neutron_plugin_ml2('DEFAULT/foo').with_value('fooValue')
should contain_neutron_plugin_ml2('DEFAULT/bar').with_value('barValue')
should contain_neutron_plugin_ml2('DEFAULT/baz').with_ensure('absent')
end
end
@ -211,10 +210,10 @@ describe 'neutron::config' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron_config'
it_configures 'neutron_api_config'
it_configures 'neutron_agent_config'
it_configures 'neutron_plugin_config'
it_behaves_like 'neutron_config'
it_behaves_like 'neutron_api_config'
it_behaves_like 'neutron_agent_config'
it_behaves_like 'neutron_plugin_config'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::db::mysql' do
let :pre_condition do
'include mysql::server'
end
@ -12,78 +11,82 @@ describe 'neutron::db::mysql' do
}
end
let :facts do
{
:osfamily => 'Debian',
}
end
describe 'with only required params' do
it { is_expected.to contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
) }
end
describe "overriding allowed_hosts param to array" do
let :params do
{
:password => 'neutronpass',
:allowed_hosts => ['127.0.0.1','%'],
}
end
it { is_expected.to contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*E7D4FEBBE0A141B5E4B413EAF85CCB49746A2497',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => ['127.0.0.1','%'],
) }
end
describe "overriding allowed_hosts param to string" do
let :params do
{
:password => 'neutronpass2',
:allowed_hosts => '192.168.1.1',
}
end
it { is_expected.to contain_openstacklib__db__mysql('neutron').with(
shared_examples 'neutron::db::mysql' do
context 'with only required params' do
it { should contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*32C4202C8C2D4430442B55CCA765BD47D5D2E1A2',
:password_hash => '*74B1C21ACE0C2D6B0678A5E503D2A60E8F9651A3',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '192.168.1.1',
) }
end
describe "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'neutronpass2',
:allowed_hosts => '127.0.0.1',
}
) }
end
it { is_expected.to contain_openstacklib__db__mysql('neutron').with(
context "overriding allowed_hosts param to array" do
let :params do
{
:password => 'neutronpass',
:allowed_hosts => ['127.0.0.1','%'],
}
end
it { should contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*32C4202C8C2D4430442B55CCA765BD47D5D2E1A2',
:password_hash => '*E7D4FEBBE0A141B5E4B413EAF85CCB49746A2497',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '127.0.0.1',
) }
:allowed_hosts => ['127.0.0.1','%'],
) }
end
context "overriding allowed_hosts param to string" do
let :params do
{
:password => 'neutronpass2',
:allowed_hosts => '192.168.1.1',
}
end
it { should contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*32C4202C8C2D4430442B55CCA765BD47D5D2E1A2',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '192.168.1.1',
)}
end
context "overriding allowed_hosts param equals to host param " do
let :params do
{
:password => 'neutronpass2',
:allowed_hosts => '127.0.0.1',
}
end
it { should contain_openstacklib__db__mysql('neutron').with(
:user => 'neutron',
:password_hash => '*32C4202C8C2D4430442B55CCA765BD47D5D2E1A2',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:allowed_hosts => '127.0.0.1',
)}
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 'neutron::db::mysql'
end
end
end

View File

@ -1,8 +1,7 @@
require 'spec_helper'
describe 'neutron::db::postgresql' do
shared_examples_for 'neutron::db::postgresql' do
shared_examples 'neutron::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
@ -11,18 +10,12 @@ describe 'neutron::db::postgresql' do
'include postgresql::server'
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
context 'with only required parameters' do
let :params do
req_params
end
it { is_expected.to contain_postgresql__server__db('neutron').with(
it { should contain_postgresql__server__db('neutron').with(
:user => 'neutron',
:password => 'md5696acd1dd66513a556a18a1beccd03d1'
)}
@ -41,8 +34,7 @@ describe 'neutron::db::postgresql' do
}))
end
it_configures 'neutron::db::postgresql'
it_behaves_like 'neutron::db::postgresql'
end
end
end

View File

@ -1,12 +1,9 @@
require 'spec_helper'
describe 'neutron::db' do
shared_examples 'neutron::db' do
context 'with default parameters' do
it { is_expected.to contain_oslo__db('neutron_config').with(
it { should contain_oslo__db('neutron_config').with(
:db_max_retries => '<SERVICE DEFAULT>',
:connection => 'sqlite:////var/lib/neutron/ovs.sqlite',
:idle_timeout => '<SERVICE DEFAULT>',
@ -22,7 +19,8 @@ describe 'neutron::db' do
context 'with specific parameters' do
let :params do
{ :database_connection => 'mysql+pymysql://neutron:neutron@localhost/neutron',
{
:database_connection => 'mysql+pymysql://neutron:neutron@localhost/neutron',
:database_idle_timeout => '3601',
:database_min_pool_size => '2',
:database_max_pool_size => '11',
@ -34,7 +32,7 @@ describe 'neutron::db' do
}
end
it { is_expected.to contain_oslo__db('neutron_config').with(
it { should contain_oslo__db('neutron_config').with(
:db_max_retries => '-1',
:connection => 'mysql+pymysql://neutron:neutron@localhost/neutron',
:idle_timeout => '3601',
@ -53,7 +51,7 @@ describe 'neutron::db' do
{ :database_connection => 'mysql+pymysql://neutron:neutron@localhost/neutron' }
end
it { is_expected.to contain_oslo__db('neutron_config').with(
it { should contain_oslo__db('neutron_config').with(
:connection => 'mysql+pymysql://neutron:neutron@localhost/neutron',
)}
end
@ -64,7 +62,7 @@ describe 'neutron::db' do
end
it 'install the proper backend package' do
is_expected.to contain_package('python-psycopg2').with(:ensure => 'present')
should contain_package('python-psycopg2').with(:ensure => 'present')
end
end
@ -74,7 +72,7 @@ describe 'neutron::db' do
{ :database_connection => 'redis://neutron:neutron@localhost/neutron', }
end
it_raises 'a Puppet::Error', /validate_re/
it { should raise_error(Puppet::Error, /validate_re/) }
end
context 'with incorrect database_connection string' do
@ -82,49 +80,34 @@ describe 'neutron::db' do
{ :database_connection => 'foo+pymysql://neutron:neutron@localhost/neutron', }
end
it_raises 'a Puppet::Error', /validate_re/
it { should raise_error(Puppet::Error, /validate_re/) }
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:operatingsystem => 'Debian',
:operatingsystemrelease => 'jessie',
})
end
it_configures 'neutron::db'
shared_examples 'neutron::db on Debian' do
context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql://neutron:neutron@localhost/neutron' }
end
it { is_expected.to contain_package('python-pymysql').with({ :ensure => 'present', :name => 'python-pymysql' }) }
it { should contain_package('python-pymysql').with({ :ensure => 'present', :name => 'python-pymysql' }) }
end
end
context 'on Redhat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7.1',
})
end
it_configures 'neutron::db'
context 'using pymysql driver' do
let :params do
{ :database_connection => 'mysql+pymysql://neutron:neutron@localhost/neutron' }
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 'neutron::db'
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron::db on Debian'
end
end
end
end

View File

@ -1,11 +1,9 @@
require 'spec_helper'
describe 'neutron::db::sync' do
shared_examples_for 'neutron-dbsync' do
shared_examples 'neutron-dbsync' do
it 'runs neutron-db-sync' do
is_expected.to contain_exec('neutron-db-sync').with(
should contain_exec('neutron-db-sync').with(
:command => 'neutron-db-manage upgrade heads',
:path => '/usr/bin',
:refreshonly => 'true',
@ -29,7 +27,7 @@ describe 'neutron::db::sync' do
end
it {
is_expected.to contain_exec('neutron-db-sync').with(
should contain_exec('neutron-db-sync').with(
:command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade heads',
:path => '/usr/bin',
:refreshonly => 'true',
@ -54,7 +52,7 @@ describe 'neutron::db::sync' do
end
it {
is_expected.to contain_exec('neutron-db-sync').with(
should contain_exec('neutron-db-sync').with(
:command => 'neutron-db-manage upgrade heads',
:path => '/usr/bin',
:refreshonly => 'true',
@ -83,8 +81,7 @@ describe 'neutron::db::sync' do
}))
end
it_configures 'neutron-dbsync'
it_behaves_like 'neutron-dbsync'
end
end
end

View File

@ -1,25 +1,24 @@
require 'spec_helper'
describe 'neutron::designate' do
let :req_params do
{ :password => 'secret',
:url => 'http://ip/designate' }
end
shared_examples_for 'neutron designate' do
shared_examples 'neutron designate' do
context 'with default parameters' do
let :params do
req_params
end
it 'configures designate in neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
is_expected.to contain_neutron_config('designate/url').with_value('http://ip/designate')
is_expected.to contain_neutron_config('designate/password').with_value('secret')
is_expected.to contain_neutron_config('designate/username').with_value('neutron')
is_expected.to contain_neutron_config('designate/auth_type').with_value('password')
is_expected.to contain_neutron_config('designate/project_name').with_value('services')
should contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
should contain_neutron_config('designate/url').with_value('http://ip/designate')
should contain_neutron_config('designate/password').with_value('secret')
should contain_neutron_config('designate/username').with_value('neutron')
should contain_neutron_config('designate/auth_type').with_value('password')
should contain_neutron_config('designate/project_name').with_value('services')
end
end
@ -43,22 +42,22 @@ describe 'neutron::designate' do
end
it 'configures designate in neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
is_expected.to contain_neutron_config('designate/url').with_value('http://ip/designate')
is_expected.to contain_neutron_config('designate/password').with_value('secret')
is_expected.to contain_neutron_config('designate/username').with_value('user')
is_expected.to contain_neutron_config('designate/auth_type').with_value('token')
is_expected.to contain_neutron_config('designate/project_id').with_value('id1')
is_expected.to contain_neutron_config('designate/project_name').with_value('proj')
is_expected.to contain_neutron_config('designate/project_domain_id').with_value('domain1')
is_expected.to contain_neutron_config('designate/project_domain_name').with_value('Domain1')
is_expected.to contain_neutron_config('designate/user_domain_id').with_value('domain2')
is_expected.to contain_neutron_config('designate/user_domain_name').with_value('Domain2')
is_expected.to contain_neutron_config('designate/auth_url').with_value('http://auth/')
is_expected.to contain_neutron_config('designate/allow_reverse_dns_lookup').with_value(false)
is_expected.to contain_neutron_config('designate/ipv4_ptr_zone_prefix_size').with_value(765)
is_expected.to contain_neutron_config('designate/ipv6_ptr_zone_prefix_size').with_value(876)
is_expected.to contain_neutron_config('designate/ptr_zone_email').with_value('foo@example.com')
should contain_neutron_config('DEFAULT/external_dns_driver').with_value('designate')
should contain_neutron_config('designate/url').with_value('http://ip/designate')
should contain_neutron_config('designate/password').with_value('secret')
should contain_neutron_config('designate/username').with_value('user')
should contain_neutron_config('designate/auth_type').with_value('token')
should contain_neutron_config('designate/project_id').with_value('id1')
should contain_neutron_config('designate/project_name').with_value('proj')
should contain_neutron_config('designate/project_domain_id').with_value('domain1')
should contain_neutron_config('designate/project_domain_name').with_value('Domain1')
should contain_neutron_config('designate/user_domain_id').with_value('domain2')
should contain_neutron_config('designate/user_domain_name').with_value('Domain2')
should contain_neutron_config('designate/auth_url').with_value('http://auth/')
should contain_neutron_config('designate/allow_reverse_dns_lookup').with_value(false)
should contain_neutron_config('designate/ipv4_ptr_zone_prefix_size').with_value(765)
should contain_neutron_config('designate/ipv6_ptr_zone_prefix_size').with_value(876)
should contain_neutron_config('designate/ptr_zone_email').with_value('foo@example.com')
end
end
end
@ -71,7 +70,7 @@ describe 'neutron::designate' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron designate'
it_behaves_like 'neutron designate'
end
end
end

View File

@ -1,72 +1,64 @@
require 'spec_helper'
describe 'neutron' do
let :params do
{ :package_ensure => 'present',
:core_plugin => 'ml2',
:auth_strategy => 'keystone',
:log_dir => '/var/log/neutron',
:purge_config => false,
{
:package_ensure => 'present',
:core_plugin => 'ml2',
:auth_strategy => 'keystone',
:log_dir => '/var/log/neutron',
:purge_config => false,
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron' do
it_configures 'a neutron base installation'
shared_examples 'neutron' do
it_behaves_like 'a neutron base installation'
context 'with rabbitmq heartbeat configured' do
before { params.merge!( :rabbit_heartbeat_timeout_threshold => '60', :rabbit_heartbeat_rate => '10' ) }
it_configures 'rabbit with heartbeat configured'
it_behaves_like 'rabbit with heartbeat configured'
end
context 'with rabbitmq durable queues configured' do
before { params.merge!( :amqp_durable_queues => true ) }
it_configures 'rabbit with durable queues'
it_behaves_like 'rabbit with durable queues'
end
context 'with rabbitmq non default transient_queues_ttl' do
before { params.merge!( :rabbit_transient_queues_ttl => 20 ) }
it_configures 'rabbit with non default transient_queues_ttl'
it_behaves_like 'rabbit with non default transient_queues_ttl'
end
it_configures 'with SSL enabled with kombu'
it_configures 'with SSL enabled without kombu'
it_configures 'with SSL disabled'
it_configures 'with SSL and kombu wrongly configured'
it_configures 'with SSL socket options set'
it_configures 'with SSL socket options set with wrong parameters'
it_configures 'with SSL socket options left by default'
it_configures 'with syslog disabled'
it_configures 'with syslog enabled'
it_configures 'with log_file specified'
it_configures 'without service_plugins'
it_configures 'with service_plugins'
it_configures 'with host defined'
it_configures 'with dns_domain defined'
it_configures 'with transport_url defined'
it_configures 'with rootwrap daemon'
it_configures 'with max_allowed_address_pair defined'
it_configures 'when disabling vlan_transparent'
it_configures 'when enabling vlan_transparent'
it_behaves_like 'with SSL enabled with kombu'
it_behaves_like 'with SSL enabled without kombu'
it_behaves_like 'with SSL disabled'
it_behaves_like 'with SSL and kombu wrongly configured'
it_behaves_like 'with SSL socket options set'
it_behaves_like 'with SSL socket options set with wrong parameters'
it_behaves_like 'with SSL socket options left by default'
it_behaves_like 'with syslog disabled'
it_behaves_like 'with syslog enabled'
it_behaves_like 'with log_file specified'
it_behaves_like 'without service_plugins'
it_behaves_like 'with service_plugins'
it_behaves_like 'with host defined'
it_behaves_like 'with dns_domain defined'
it_behaves_like 'with transport_url defined'
it_behaves_like 'with rootwrap daemon'
it_behaves_like 'with max_allowed_address_pair defined'
it_behaves_like 'when disabling vlan_transparent'
it_behaves_like 'when enabling vlan_transparent'
context 'with amqp messaging' do
it_configures 'amqp support'
it_behaves_like 'amqp support'
end
end
shared_examples_for 'a neutron base installation' do
it { is_expected.to contain_class('neutron::params') }
shared_examples 'a neutron base installation' do
it { should contain_class('neutron::params') }
it 'installs neutron package' do
is_expected.to contain_package('neutron').with(
should contain_package('neutron').with(
:ensure => 'present',
:name => platform_params[:common_package_name],
:tag => ['openstack', 'neutron-package'],
@ -74,158 +66,158 @@ describe 'neutron' do
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_config').with({
should contain_resources('neutron_config').with({
:purge => false
})
end
it 'configures messaging notifications' do
is_expected.to contain_neutron_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_notifications/topics').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('oslo_messaging_notifications/driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('oslo_messaging_notifications/topics').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('oslo_messaging_notifications/transport_url').with_value('<SERVICE DEFAULT>')
end
it 'configures rabbit' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value( '<SERVICE DEFAULT>' )
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_compression').with_value( '<SERVICE DEFAULT>' )
should contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value( '<SERVICE DEFAULT>' )
should contain_neutron_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value( '<SERVICE DEFAULT>' )
should contain_neutron_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value( '<SERVICE DEFAULT>' )
should contain_neutron_config('oslo_messaging_rabbit/kombu_compression').with_value( '<SERVICE DEFAULT>' )
end
it 'configures neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/bind_host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/bind_port').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/auth_strategy').with_value('keystone')
is_expected.to contain_neutron_config('DEFAULT/core_plugin').with_value( params[:core_plugin] )
is_expected.to contain_neutron_config('DEFAULT/base_mac').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/dhcp_lease_duration').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/host').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/dns_domain').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/dhcp_agents_per_network').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/global_physnet_mtu').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/dhcp_agent_notification').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/allow_bulk').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/allow_overlapping_ips').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/api_extensions_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/control_exchange').with_value('neutron')
is_expected.to contain_neutron_config('DEFAULT/state_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('oslo_concurrency/lock_path').with_value('$state_path/lock')
is_expected.to contain_neutron_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/vlan_transparent').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('agent/root_helper').with_value('sudo neutron-rootwrap /etc/neutron/rootwrap.conf')
is_expected.to contain_neutron_config('agent/root_helper_daemon').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('agent/report_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/bind_host').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/bind_port').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/auth_strategy').with_value('keystone')
should contain_neutron_config('DEFAULT/core_plugin').with_value( params[:core_plugin] )
should contain_neutron_config('DEFAULT/base_mac').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/dhcp_lease_duration').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/host').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/dns_domain').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/dhcp_agents_per_network').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/global_physnet_mtu').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/dhcp_agent_notification').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/allow_bulk').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/allow_overlapping_ips').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/api_extensions_path').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/control_exchange').with_value('neutron')
should contain_neutron_config('DEFAULT/state_path').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('oslo_concurrency/lock_path').with_value('$state_path/lock')
should contain_neutron_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/vlan_transparent').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('agent/root_helper').with_value('sudo neutron-rootwrap /etc/neutron/rootwrap.conf')
should contain_neutron_config('agent/root_helper_daemon').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('agent/report_interval').with_value('<SERVICE DEFAULT>')
end
end
shared_examples_for 'rabbit with heartbeat configured' do
shared_examples 'rabbit with heartbeat configured' do
it 'in neutron.conf' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10')
should contain_neutron_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('60')
should contain_neutron_config('oslo_messaging_rabbit/heartbeat_rate').with_value('10')
end
end
shared_examples_for 'rabbit with durable queues' do
shared_examples 'rabbit with durable queues' do
it 'in neutron.conf' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true)
should contain_neutron_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true)
end
end
shared_examples_for 'rabbit with non default transient_queues_ttl' do
shared_examples 'rabbit with non default transient_queues_ttl' do
it 'in neutron.conf' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_transient_queues_ttl').with_value(20)
should contain_neutron_config('oslo_messaging_rabbit/rabbit_transient_queues_ttl').with_value(20)
end
end
shared_examples_for 'rabbit_ha_queues set to false' do
shared_examples 'rabbit_ha_queues set to false' do
it 'in neutron.conf' do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false)
should contain_neutron_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false)
end
end
shared_examples_for 'notification_driver and notification_topics' do
shared_examples 'notification_driver and notification_topics' do
it 'in neutron.conf' do
is_expected.to contain_neutron_config('oslo_messaging_notifications/driver').with_value( params[:notification_driver] )
is_expected.to contain_neutron_config('oslo_messaging_notifications/topics').with_value( params[:notification_topics] )
is_expected.to contain_neutron_config('oslo_messaging_notifications/transport_url').with_value( params[:notification_transport_url] )
should contain_neutron_config('oslo_messaging_notifications/driver').with_value( params[:notification_driver] )
should contain_neutron_config('oslo_messaging_notifications/topics').with_value( params[:notification_topics] )
should contain_neutron_config('oslo_messaging_notifications/transport_url').with_value( params[:notification_transport_url] )
end
end
shared_examples_for 'with SSL socket options set' do
shared_examples 'with SSL socket options set' do
before do
params.merge!(
:use_ssl => true,
:cert_file => '/path/to/cert',
:key_file => '/path/to/key',
:ca_file => '/path/to/ca'
:use_ssl => true,
:cert_file => '/path/to/cert',
:key_file => '/path/to/key',
:ca_file => '/path/to/ca'
)
end
it { is_expected.to contain_neutron_config('DEFAULT/use_ssl').with_value('true') }
it { is_expected.to contain_neutron_config('ssl/cert_file').with_value('/path/to/cert') }
it { is_expected.to contain_neutron_config('ssl/key_file').with_value('/path/to/key') }
it { is_expected.to contain_neutron_config('ssl/ca_file').with_value('/path/to/ca') }
it { should contain_neutron_config('DEFAULT/use_ssl').with_value('true') }
it { should contain_neutron_config('ssl/cert_file').with_value('/path/to/cert') }
it { should contain_neutron_config('ssl/key_file').with_value('/path/to/key') }
it { should contain_neutron_config('ssl/ca_file').with_value('/path/to/ca') }
end
shared_examples_for 'with SSL socket options set with wrong parameters' do
shared_examples 'with SSL socket options set with wrong parameters' do
before do
params.merge!(
:use_ssl => true,
:key_file => '/path/to/key',
:ca_file => '/path/to/ca'
:use_ssl => true,
:key_file => '/path/to/key',
:ca_file => '/path/to/ca'
)
end
it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/
it { should raise_error(Puppet::Error, /The cert_file parameter is required when use_ssl is set to true/) }
end
shared_examples_for 'with SSL socket options left by default' do
shared_examples 'with SSL socket options left by default' do
it { is_expected.to contain_neutron_config('DEFAULT/use_ssl').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('ssl/cert_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('ssl/key_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('ssl/ca_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('DEFAULT/use_ssl').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('ssl/cert_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('ssl/key_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('ssl/ca_file').with_value('<SERVICE DEFAULT>') }
end
shared_examples_for 'with SSL socket options set and no ca_file' do
shared_examples 'with SSL socket options set and no ca_file' do
before do
params.merge!(
:use_ssl => true,
:cert_file => '/path/to/cert',
:key_file => '/path/to/key'
:use_ssl => true,
:cert_file => '/path/to/cert',
:key_file => '/path/to/key'
)
end
it { is_expected.to contain_neutron_config('DEFAULT/use_ssl').with_value('true') }
it { is_expected.to contain_neutron_config('ssl/cert_file').with_value('/path/to/cert') }
it { is_expected.to contain_neutron_config('ssl/key_file').with_value('/path/to/key') }
it { is_expected.to contain_neutron_config('ssl/ca_file').with_ensure('absent') }
it { should contain_neutron_config('DEFAULT/use_ssl').with_value('true') }
it { should contain_neutron_config('ssl/cert_file').with_value('/path/to/cert') }
it { should contain_neutron_config('ssl/key_file').with_value('/path/to/key') }
it { should contain_neutron_config('ssl/ca_file').with_ensure('absent') }
end
shared_examples_for 'with SSL socket options disabled with ca_file' do
shared_examples 'with SSL socket options disabled with ca_file' do
before do
params.merge!(
:use_ssl => false,
:ca_file => '/path/to/ca'
:use_ssl => false,
:ca_file => '/path/to/ca'
)
end
it_raises 'a Puppet::Error', /The ca_file parameter requires that use_ssl to be set to true/
it { should raise_error(Puppet::Error, /The ca_file parameter requires that use_ssl to be set to true/) }
end
shared_examples_for 'with syslog disabled' do
shared_examples 'with syslog disabled' do
before do
params.merge!(
:use_syslog => false,
:use_syslog => false,
)
end
it { is_expected.to contain_neutron_config('DEFAULT/use_syslog').with_value(false) }
it { should contain_neutron_config('DEFAULT/use_syslog').with_value(false) }
end
shared_examples_for 'with non-default kombu options' do
shared_examples 'with non-default kombu options' do
before do
params.merge!(
:kombu_missing_consumer_retry_timeout => '5',
@ -236,14 +228,14 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('30')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value('5')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('shuffle')
is_expected.to contain_neutron_config('oslo_messaging_rabbit/kombu_compression').with_value('gzip')
should contain_neutron_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('30')
should contain_neutron_config('oslo_messaging_rabbit/kombu_missing_consumer_retry_timeout').with_value('5')
should contain_neutron_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('shuffle')
should contain_neutron_config('oslo_messaging_rabbit/kombu_compression').with_value('gzip')
end
end
shared_examples_for 'with SSL enabled with kombu' do
shared_examples 'with SSL enabled with kombu' do
before do
params.merge!(
:rabbit_use_ssl => true,
@ -254,7 +246,7 @@ describe 'neutron' do
)
end
it { is_expected.to contain_oslo__messaging__rabbit('neutron_config').with(
it { should contain_oslo__messaging__rabbit('neutron_config').with(
:rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
@ -263,30 +255,30 @@ describe 'neutron' do
)}
end
shared_examples_for 'with SSL enabled without kombu' do
shared_examples 'with SSL enabled without kombu' do
before do
params.merge!(
:rabbit_use_ssl => true
:rabbit_use_ssl => true
)
end
it { is_expected.to contain_oslo__messaging__rabbit('neutron_config').with(
:rabbit_use_ssl => true,
it { should contain_oslo__messaging__rabbit('neutron_config').with(
:rabbit_use_ssl => true,
)}
end
shared_examples_for 'with SSL disabled' do
shared_examples 'with SSL disabled' do
it { is_expected.to contain_oslo__messaging__rabbit('neutron_config').with(
:rabbit_use_ssl => '<SERVICE DEFAULT>',
it { should contain_oslo__messaging__rabbit('neutron_config').with(
:rabbit_use_ssl => '<SERVICE DEFAULT>',
)}
end
shared_examples_for 'with SSL and kombu wrongly configured' do
shared_examples 'with SSL and kombu wrongly configured' do
before do
params.merge!(
:rabbit_use_ssl => true,
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_keyfile => '/path/to/ssl/keyfile'
)
end
@ -295,13 +287,13 @@ describe 'neutron' do
context 'without kombu_ssl_keyfile parameter' do
before { params.delete(:kombu_ssl_keyfile) }
it_raises 'a Puppet::Error', /The kombu_ssl_certfile and kombu_ssl_keyfile parameters must be used together/
it { should raise_error(Puppet::Error, /The kombu_ssl_certfile and kombu_ssl_keyfile parameters must be used together/) }
end
end
end
shared_examples_for 'with syslog enabled' do
shared_examples 'with syslog enabled' do
before do
params.merge!(
:use_syslog => 'true'
@ -309,11 +301,11 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('DEFAULT/use_syslog').with_value(true)
should contain_neutron_config('DEFAULT/use_syslog').with_value(true)
end
end
shared_examples_for 'with log_file specified' do
shared_examples 'with log_file specified' do
before do
params.merge!(
:log_file => '/var/log/neutron/server.log',
@ -321,49 +313,49 @@ describe 'neutron' do
)
end
it 'configures logging' do
is_expected.to contain_neutron_config('DEFAULT/log_file').with_value(params[:log_file])
is_expected.to contain_neutron_config('DEFAULT/log_dir').with_value(params[:log_dir])
should contain_neutron_config('DEFAULT/log_file').with_value(params[:log_file])
should contain_neutron_config('DEFAULT/log_dir').with_value(params[:log_dir])
end
end
shared_examples_for 'with state and lock paths set' do
shared_examples 'with state and lock paths set' do
before { params.merge!(
:state_path => 'state_path',
:lock_path => 'lock_path'
)}
it {
is_expected.to contain_neutron_config('DEFAULT/state_path').with_value('state_path')
is_expected.to contain_neutron_config('oslo_concurrency/lock_path').with_value('lock_path')
should contain_neutron_config('DEFAULT/state_path').with_value('state_path')
should contain_neutron_config('oslo_concurrency/lock_path').with_value('lock_path')
}
end
shared_examples_for 'when disabling vlan_transparent' do
shared_examples 'when disabling vlan_transparent' do
before do
params.merge!(
:vlan_transparent => false
)
end
it do
is_expected.to contain_neutron_config('DEFAULT/vlan_transparent').with_value(false)
should contain_neutron_config('DEFAULT/vlan_transparent').with_value(false)
end
end
shared_examples_for 'when enabling vlan_transparent' do
shared_examples 'when enabling vlan_transparent' do
before do
params.merge!(
:vlan_transparent => true
)
end
it do
is_expected.to contain_neutron_config('DEFAULT/vlan_transparent').with_value(true)
should contain_neutron_config('DEFAULT/vlan_transparent').with_value(true)
end
end
shared_examples_for 'without service_plugins' do
it { is_expected.not_to contain_neutron_config('DEFAULT/service_plugins') }
shared_examples 'without service_plugins' do
it { should_not contain_neutron_config('DEFAULT/service_plugins') }
end
shared_examples_for 'with service_plugins' do
shared_examples 'with service_plugins' do
before do
params.merge!(
:service_plugins => ['router','firewall','lbaas','vpnaas','metering','qos']
@ -371,12 +363,12 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('DEFAULT/service_plugins').with_value('router,firewall,lbaas,vpnaas,metering,qos')
should contain_neutron_config('DEFAULT/service_plugins').with_value('router,firewall,lbaas,vpnaas,metering,qos')
end
end
shared_examples_for 'with global_physnet_mtu defined' do
shared_examples 'with global_physnet_mtu defined' do
before do
params.merge!(
:global_physnet_mtu => 9000
@ -384,11 +376,11 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('DEFAULT/global_physnet_mtu').with_value(params[:global_physnet_mtu])
should contain_neutron_config('DEFAULT/global_physnet_mtu').with_value(params[:global_physnet_mtu])
end
end
shared_examples_for 'with host defined' do
shared_examples 'with host defined' do
before do
params.merge!(
:host => 'test-001.example.org'
@ -396,11 +388,11 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('DEFAULT/host').with_value(params[:host])
should contain_neutron_config('DEFAULT/host').with_value(params[:host])
end
end
shared_examples_for 'with dns_domain defined' do
shared_examples 'with dns_domain defined' do
before do
params.merge!(
:dns_domain => 'testlocal'
@ -408,11 +400,11 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('DEFAULT/dns_domain').with_value(params[:dns_domain])
should contain_neutron_config('DEFAULT/dns_domain').with_value(params[:dns_domain])
end
end
shared_examples_for 'with transport_url defined' do
shared_examples 'with transport_url defined' do
before do
params.merge!(
:default_transport_url => 'rabbit://rabbit_user:password@localhost:5673'
@ -420,11 +412,11 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('DEFAULT/transport_url').with_value(params[:default_transport_url])
should contain_neutron_config('DEFAULT/transport_url').with_value(params[:default_transport_url])
end
end
shared_examples_for 'with rootwrap daemon' do
shared_examples 'with rootwrap daemon' do
before do
params.merge!(
:root_helper_daemon => 'sudo neutron-rootwrap-daemon /etc/neutron/rootwrap.conf'
@ -432,28 +424,28 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('agent/root_helper_daemon').with_value(params[:root_helper_daemon])
should contain_neutron_config('agent/root_helper_daemon').with_value(params[:root_helper_daemon])
end
end
shared_examples_for 'amqp support' do
shared_examples 'amqp support' do
context 'with default amqp parameters' do
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/server_request_prefix').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/broadcast_prefix').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/group_request_prefix').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/container_name').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/idle_timeout').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/trace').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/ssl_ca_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/ssl_cert_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/ssl_key_file').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/ssl_key_password').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/allow_insecure_clients').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/username').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/password').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/server_request_prefix').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/broadcast_prefix').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/group_request_prefix').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/container_name').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/idle_timeout').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/trace').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/ssl_ca_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/ssl_cert_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/ssl_key_file').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/ssl_key_password').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/allow_insecure_clients').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/username').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/password').with_value('<SERVICE DEFAULT>') }
end
context 'with overridden amqp parameters' do
@ -467,25 +459,25 @@ describe 'neutron' do
:amqp_password => 'password',
) }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/server_request_prefix').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/broadcast_prefix').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/group_request_prefix').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/container_name').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/idle_timeout').with_value('60') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/trace').with_value('true') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/ssl_ca_file').with_value('/path/to/ca.cert') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/ssl_cert_file').with_value('/path/to/certfile') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/ssl_key_file').with_value('/path/to/key') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/allow_insecure_clients').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/username').with_value('amqp_user') }
it { is_expected.to contain_neutron_config('oslo_messaging_amqp/password').with_value('password') }
it { should contain_neutron_config('oslo_messaging_amqp/server_request_prefix').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/broadcast_prefix').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/group_request_prefix').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/container_name').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/idle_timeout').with_value('60') }
it { should contain_neutron_config('oslo_messaging_amqp/trace').with_value('true') }
it { should contain_neutron_config('oslo_messaging_amqp/ssl_ca_file').with_value('/path/to/ca.cert') }
it { should contain_neutron_config('oslo_messaging_amqp/ssl_cert_file').with_value('/path/to/certfile') }
it { should contain_neutron_config('oslo_messaging_amqp/ssl_key_file').with_value('/path/to/key') }
it { should contain_neutron_config('oslo_messaging_amqp/allow_insecure_clients').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/sasl_mechanisms').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/sasl_config_dir').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/sasl_config_name').with_value('<SERVICE DEFAULT>') }
it { should contain_neutron_config('oslo_messaging_amqp/username').with_value('amqp_user') }
it { should contain_neutron_config('oslo_messaging_amqp/password').with_value('password') }
end
end
shared_examples_for 'with max_allowed_address_pair defined' do
shared_examples 'with max_allowed_address_pair defined' do
before do
params.merge!(
:max_allowed_address_pair => '50'
@ -493,38 +485,32 @@ describe 'neutron' do
end
it do
is_expected.to contain_neutron_config('DEFAULT/max_allowed_address_pair').with_value(params[:max_allowed_address_pair])
should contain_neutron_config('DEFAULT/max_allowed_address_pair').with_value(params[:max_allowed_address_pair])
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:common_package_name => 'neutron-common'
}
when 'RedHat'
{
:common_package_name => 'openstack-neutron'
}
end
end
it_behaves_like 'neutron'
end
let :platform_params do
{ :common_package_name => 'neutron-common' }
end
it_configures 'neutron'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
let :platform_params do
{ :common_package_name => 'openstack-neutron' }
end
it_configures 'neutron'
end
end

View File

@ -1,173 +1,157 @@
require 'spec_helper'
describe 'neutron::keystone::auth' do
shared_examples 'neutron::keystone::auth' do
context 'with default class parameters' do
let :params do
{
:password => 'neutron_password',
:tenant => 'foobar'
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
describe 'with default class parameters' do
let :params do
{
it { should contain_keystone_user('neutron').with(
:ensure => 'present',
:password => 'neutron_password',
:tenant => 'foobar'
}
)}
it { should contain_keystone_user_role('neutron@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
it { should contain_keystone_service('neutron::network').with(
:ensure => 'present',
:description => 'Neutron Networking Service'
)}
it { should contain_keystone_endpoint('RegionOne/neutron::network').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:9696",
:admin_url => "http://127.0.0.1:9696",
:internal_url => "http://127.0.0.1:9696"
)}
end
it { is_expected.to contain_keystone_user('neutron').with(
:ensure => 'present',
:password => 'neutron_password',
) }
context 'when configuring neutron-server' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'test',
}
class { 'neutron::server': }"
end
it { is_expected.to contain_keystone_user_role('neutron@foobar').with(
:ensure => 'present',
:roles => ['admin']
)}
let :params do
{
:password => 'neutron_password',
:tenant => 'foobar'
}
end
it { is_expected.to contain_keystone_service('neutron::network').with(
:ensure => 'present',
:description => 'Neutron Networking Service'
) }
it { is_expected.to contain_keystone_endpoint('RegionOne/neutron::network').with(
:ensure => 'present',
:public_url => "http://127.0.0.1:9696",
:admin_url => "http://127.0.0.1:9696",
:internal_url => "http://127.0.0.1:9696"
) }
end
describe 'when configuring neutron-server' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'test',
}
class { 'neutron::server': }"
end
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian'
}))
end
context 'with endpoint URL parameters' do
let :params do
{
:password => 'neutron_password',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'https://10.10.10.11:81',
:admin_url => 'https://10.10.10.12:81'
}
end
let :params do
{
:password => 'neutron_password',
:tenant => 'foobar'
}
end
end
describe 'with endpoint URL parameters' do
let :params do
{
:password => 'neutron_password',
it { should contain_keystone_endpoint('RegionOne/neutron::network').with(
:ensure => 'present',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'https://10.10.10.11:81',
:admin_url => 'https://10.10.10.12:81'
}
) }
end
it { is_expected.to contain_keystone_endpoint('RegionOne/neutron::network').with(
:ensure => 'present',
:public_url => 'https://10.10.10.10:80',
:internal_url => 'https://10.10.10.11:81',
:admin_url => 'https://10.10.10.12:81'
) }
end
context 'when overriding auth name' do
let :params do
{
:password => 'foo',
:auth_name => 'neutrony'
}
end
describe 'when overriding auth name' do
let :params do
{
:password => 'foo',
:auth_name => 'neutrony'
}
it { should contain_keystone_user('neutrony') }
it { should contain_keystone_user_role('neutrony@services') }
it { should contain_keystone_service('neutron::network') }
it { should contain_keystone_endpoint('RegionOne/neutron::network') }
end
it { is_expected.to contain_keystone_user('neutrony') }
context 'when overriding service name' do
let :params do
{
:service_name => 'neutron_service',
:password => 'neutron_password'
}
end
it { is_expected.to contain_keystone_user_role('neutrony@services') }
it { is_expected.to contain_keystone_service('neutron::network') }
it { is_expected.to contain_keystone_endpoint('RegionOne/neutron::network') }
end
describe 'when overriding service name' do
let :params do
{
:service_name => 'neutron_service',
:password => 'neutron_password'
}
it { should contain_keystone_user('neutron') }
it { should contain_keystone_user_role('neutron@services') }
it { should contain_keystone_service('neutron_service::network') }
it { should contain_keystone_endpoint('RegionOne/neutron_service::network') }
end
it { is_expected.to contain_keystone_user('neutron') }
it { is_expected.to contain_keystone_user_role('neutron@services') }
it { is_expected.to contain_keystone_service('neutron_service::network') }
it { is_expected.to contain_keystone_endpoint('RegionOne/neutron_service::network') }
context 'when disabling user configuration' do
let :params do
{
:password => 'neutron_password',
:configure_user => false
}
end
end
it { should_not contain_keystone_user('neutron') }
it { should contain_keystone_user_role('neutron@services') }
describe 'when disabling user configuration' do
let :params do
{
:password => 'neutron_password',
:configure_user => false
}
it { should contain_keystone_service('neutron::network').with(
:ensure => 'present',
:description => 'Neutron Networking Service'
)}
end
it { is_expected.not_to contain_keystone_user('neutron') }
context 'when disabling user and user role configuration' do
let :params do
{
:password => 'neutron_password',
:configure_user => false,
:configure_user_role => false
}
end
it { is_expected.to contain_keystone_user_role('neutron@services') }
it { should_not contain_keystone_user('neutron') }
it { should_not contain_keystone_user_role('neutron@services') }
it { is_expected.to contain_keystone_service('neutron::network').with(
:ensure => 'present',
:description => 'Neutron Networking Service'
) }
end
describe 'when disabling user and user role configuration' do
let :params do
{
:password => 'neutron_password',
:configure_user => false,
:configure_user_role => false
}
it { should contain_keystone_service('neutron::network').with(
:ensure => 'present',
:description => 'Neutron Networking Service'
)}
end
it { is_expected.not_to contain_keystone_user('neutron') }
context 'when disabling endpoint configuration' do
let :params do
{
:password => 'neutron_password',
:configure_endpoint => false
}
end
it { is_expected.not_to contain_keystone_user_role('neutron@services') }
it { is_expected.to contain_keystone_service('neutron::network').with(
:ensure => 'present',
:description => 'Neutron Networking Service'
) }
end
describe 'when disabling endpoint configuration' do
let :params do
{
:password => 'neutron_password',
:configure_endpoint => false
}
it { should_not contain_keystone_endpoint('RegionOne/neutron::network') }
end
it { is_expected.to_not contain_keystone_endpoint('RegionOne/neutron::network') }
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 'neutron::keystone::auth'
end
end
end

View File

@ -1,50 +1,47 @@
require 'spec_helper'
describe 'neutron::keystone::authtoken' do
let :params do
{ :password => 'neutron_password', }
end
shared_examples 'neutron authtoken' do
context 'with default parameters' do
it 'configure keystone_authtoken' do
is_expected.to contain_neutron_config('keystone_authtoken/username').with_value('neutron')
is_expected.to contain_neutron_config('keystone_authtoken/password').with_value('neutron_password')
is_expected.to contain_neutron_config('keystone_authtoken/auth_url').with_value('http://localhost:5000')
is_expected.to contain_neutron_config('keystone_authtoken/project_name').with_value('services')
is_expected.to contain_neutron_config('keystone_authtoken/user_domain_name').with_value('Default')
is_expected.to contain_neutron_config('keystone_authtoken/project_domain_name').with_value('Default')
is_expected.to contain_neutron_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/auth_type').with_value('password')
is_expected.to contain_neutron_config('keystone_authtoken/www_authenticate_uri').with_value('http://localhost:5000')
is_expected.to contain_neutron_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/check_revocations_for_cached').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/delay_auth_decision').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/enforce_token_bind').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/hash_algorithms').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/http_connect_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/http_request_max_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/include_service_catalog').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_dead_retry').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_socket_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_secret_key').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_security_strategy').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcache_use_advanced_pool').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/token_cache_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('keystone_authtoken/service_token_roles_required').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/username').with_value('neutron')
should contain_neutron_config('keystone_authtoken/password').with_value('neutron_password')
should contain_neutron_config('keystone_authtoken/auth_url').with_value('http://localhost:5000')
should contain_neutron_config('keystone_authtoken/project_name').with_value('services')
should contain_neutron_config('keystone_authtoken/user_domain_name').with_value('Default')
should contain_neutron_config('keystone_authtoken/project_domain_name').with_value('Default')
should contain_neutron_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/auth_type').with_value('password')
should contain_neutron_config('keystone_authtoken/www_authenticate_uri').with_value('http://localhost:5000')
should contain_neutron_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/certfile').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/check_revocations_for_cached').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/delay_auth_decision').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/enforce_token_bind').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/hash_algorithms').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/http_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/http_request_max_retries').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/include_service_catalog').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/keyfile').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_pool_dead_retry').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_pool_socket_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_secret_key').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_security_strategy').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcache_use_advanced_pool').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/region_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/token_cache_time').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('keystone_authtoken/service_token_roles_required').with_value('<SERVICE DEFAULT>')
end
end
@ -90,44 +87,44 @@ describe 'neutron::keystone::authtoken' do
end
it 'configure keystone_authtoken' do
is_expected.to contain_neutron_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/')
is_expected.to contain_neutron_config('keystone_authtoken/username').with_value(params[:username])
is_expected.to contain_neutron_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
is_expected.to contain_neutron_config('keystone_authtoken/auth_url').with_value(params[:auth_url])
is_expected.to contain_neutron_config('keystone_authtoken/project_name').with_value(params[:project_name])
is_expected.to contain_neutron_config('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name])
is_expected.to contain_neutron_config('keystone_authtoken/project_domain_name').with_value(params[:project_domain_name])
is_expected.to contain_neutron_config('keystone_authtoken/insecure').with_value(params[:insecure])
is_expected.to contain_neutron_config('keystone_authtoken/auth_section').with_value(params[:auth_section])
is_expected.to contain_neutron_config('keystone_authtoken/auth_type').with_value(params[:auth_type])
is_expected.to contain_neutron_config('keystone_authtoken/auth_version').with_value(params[:auth_version])
is_expected.to contain_neutron_config('keystone_authtoken/cache').with_value(params[:cache])
is_expected.to contain_neutron_config('keystone_authtoken/cafile').with_value(params[:cafile])
is_expected.to contain_neutron_config('keystone_authtoken/certfile').with_value(params[:certfile])
is_expected.to contain_neutron_config('keystone_authtoken/check_revocations_for_cached').with_value(params[:check_revocations_for_cached])
is_expected.to contain_neutron_config('keystone_authtoken/delay_auth_decision').with_value(params[:delay_auth_decision])
is_expected.to contain_neutron_config('keystone_authtoken/enforce_token_bind').with_value(params[:enforce_token_bind])
is_expected.to contain_neutron_config('keystone_authtoken/hash_algorithms').with_value(params[:hash_algorithms])
is_expected.to contain_neutron_config('keystone_authtoken/http_connect_timeout').with_value(params[:http_connect_timeout])
is_expected.to contain_neutron_config('keystone_authtoken/http_request_max_retries').with_value(params[:http_request_max_retries])
is_expected.to contain_neutron_config('keystone_authtoken/include_service_catalog').with_value(params[:include_service_catalog])
is_expected.to contain_neutron_config('keystone_authtoken/keyfile').with_value(params[:keyfile])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value(params[:memcache_pool_conn_get_timeout])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_dead_retry').with_value(params[:memcache_pool_dead_retry])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_maxsize').with_value(params[:memcache_pool_maxsize])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_socket_timeout').with_value(params[:memcache_pool_socket_timeout])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_pool_unused_timeout').with_value(params[:memcache_pool_unused_timeout])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_secret_key').with_value(params[:memcache_secret_key])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_security_strategy').with_value(params[:memcache_security_strategy])
is_expected.to contain_neutron_config('keystone_authtoken/memcache_use_advanced_pool').with_value(params[:memcache_use_advanced_pool])
is_expected.to contain_neutron_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211')
is_expected.to contain_neutron_config('keystone_authtoken/region_name').with_value(params[:region_name])
is_expected.to contain_neutron_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time])
is_expected.to contain_neutron_config('keystone_authtoken/service_token_roles_required').with_value(params[:service_token_roles_required])
should contain_neutron_config('keystone_authtoken/www_authenticate_uri').with_value('https://10.0.0.1:9999/')
should contain_neutron_config('keystone_authtoken/username').with_value(params[:username])
should contain_neutron_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
should contain_neutron_config('keystone_authtoken/auth_url').with_value(params[:auth_url])
should contain_neutron_config('keystone_authtoken/project_name').with_value(params[:project_name])
should contain_neutron_config('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name])
should contain_neutron_config('keystone_authtoken/project_domain_name').with_value(params[:project_domain_name])
should contain_neutron_config('keystone_authtoken/insecure').with_value(params[:insecure])
should contain_neutron_config('keystone_authtoken/auth_section').with_value(params[:auth_section])
should contain_neutron_config('keystone_authtoken/auth_type').with_value(params[:auth_type])
should contain_neutron_config('keystone_authtoken/auth_version').with_value(params[:auth_version])
should contain_neutron_config('keystone_authtoken/cache').with_value(params[:cache])
should contain_neutron_config('keystone_authtoken/cafile').with_value(params[:cafile])
should contain_neutron_config('keystone_authtoken/certfile').with_value(params[:certfile])
should contain_neutron_config('keystone_authtoken/check_revocations_for_cached').with_value(params[:check_revocations_for_cached])
should contain_neutron_config('keystone_authtoken/delay_auth_decision').with_value(params[:delay_auth_decision])
should contain_neutron_config('keystone_authtoken/enforce_token_bind').with_value(params[:enforce_token_bind])
should contain_neutron_config('keystone_authtoken/hash_algorithms').with_value(params[:hash_algorithms])
should contain_neutron_config('keystone_authtoken/http_connect_timeout').with_value(params[:http_connect_timeout])
should contain_neutron_config('keystone_authtoken/http_request_max_retries').with_value(params[:http_request_max_retries])
should contain_neutron_config('keystone_authtoken/include_service_catalog').with_value(params[:include_service_catalog])
should contain_neutron_config('keystone_authtoken/keyfile').with_value(params[:keyfile])
should contain_neutron_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value(params[:memcache_pool_conn_get_timeout])
should contain_neutron_config('keystone_authtoken/memcache_pool_dead_retry').with_value(params[:memcache_pool_dead_retry])
should contain_neutron_config('keystone_authtoken/memcache_pool_maxsize').with_value(params[:memcache_pool_maxsize])
should contain_neutron_config('keystone_authtoken/memcache_pool_socket_timeout').with_value(params[:memcache_pool_socket_timeout])
should contain_neutron_config('keystone_authtoken/memcache_pool_unused_timeout').with_value(params[:memcache_pool_unused_timeout])
should contain_neutron_config('keystone_authtoken/memcache_secret_key').with_value(params[:memcache_secret_key])
should contain_neutron_config('keystone_authtoken/memcache_security_strategy').with_value(params[:memcache_security_strategy])
should contain_neutron_config('keystone_authtoken/memcache_use_advanced_pool').with_value(params[:memcache_use_advanced_pool])
should contain_neutron_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211')
should contain_neutron_config('keystone_authtoken/region_name').with_value(params[:region_name])
should contain_neutron_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time])
should contain_neutron_config('keystone_authtoken/service_token_roles_required').with_value(params[:service_token_roles_required])
end
it 'installs python memcache package' do
is_expected.to contain_package('python-memcache')
should contain_package('python-memcache')
end
end
end
@ -140,8 +137,7 @@ describe 'neutron::keystone::authtoken' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron authtoken'
it_behaves_like 'neutron authtoken'
end
end
end

View File

@ -1,10 +1,8 @@
require 'spec_helper'
describe 'neutron::logging' do
let :params do
{
}
{}
end
let :log_params do
@ -36,27 +34,27 @@ describe 'neutron::logging' do
}
end
shared_examples_for 'neutron-logging' do
shared_examples 'neutron-logging' do
context 'with basic logging options and default settings' do
it_configures 'basic default logging settings'
it_behaves_like 'basic default logging settings'
end
context 'with basic logging options and non-default settings' do
before { params.merge!( log_params ) }
it_configures 'basic non-default logging settings'
it_behaves_like 'basic non-default logging settings'
end
context 'with extended logging options' do
before { params.merge!( log_params ) }
it_configures 'logging params set'
it_behaves_like 'logging params set'
end
end
shared_examples 'basic default logging settings' do
it 'configures neutron logging settings with default values' do
is_expected.to contain_oslo__log('neutron_config').with(
should contain_oslo__log('neutron_config').with(
:use_syslog => '<SERVICE DEFAULT>',
:use_json => '<SERVICE DEFAULT>',
:use_journal => '<SERVICE DEFAULT>',
@ -72,7 +70,7 @@ describe 'neutron::logging' do
shared_examples 'basic non-default logging settings' do
it 'configures neutron logging settings with non-default values' do
is_expected.to contain_oslo__log('neutron_config').with(
should contain_oslo__log('neutron_config').with(
:use_syslog => false,
:use_json => false,
:use_journal => true,
@ -86,9 +84,9 @@ describe 'neutron::logging' do
end
end
shared_examples_for 'logging params set' do
shared_examples 'logging params set' do
it 'enables logging params' do
is_expected.to contain_oslo__log('neutron_config').with(
should contain_oslo__log('neutron_config').with(
:logging_context_format_string =>
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
@ -117,8 +115,7 @@ describe 'neutron::logging' do
facts.merge(OSDefaults.get_facts())
end
it_configures 'neutron-logging'
it_behaves_like 'neutron-logging'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::cisco' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -11,15 +10,16 @@ describe 'neutron::plugins::cisco' do
end
let :params do
{ :keystone_username => 'neutron',
{
:keystone_username => 'neutron',
:keystone_password => 'neutron_pass',
:keystone_auth_url => 'http://127.0.0.1:5000/v2.0/',
:keystone_tenant => 'tenant',
:database_name => 'neutron',
:database_pass => 'dbpass',
:database_host => 'localhost',
:database_user => 'neutron'}
:database_user => 'neutron'
}
end
let :params_default do
@ -37,29 +37,22 @@ describe 'neutron::plugins::cisco' do
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'default cisco plugin' do
shared_examples 'default cisco plugin' do
before do
params.merge!(params_default)
end
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/cisco/cisco_plugins.ini',
)
is_expected.to contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
should contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
should contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
end
it 'should have a plugin config folder' do
is_expected.to contain_file('/etc/neutron/plugins').with(
should contain_file('/etc/neutron/plugins').with(
:ensure => 'directory',
:owner => 'root',
:group => 'neutron',
@ -68,7 +61,7 @@ describe 'neutron::plugins::cisco' do
end
it 'should have a cisco plugin config folder' do
is_expected.to contain_file('/etc/neutron/plugins/cisco').with(
should contain_file('/etc/neutron/plugins/cisco').with(
:ensure => 'directory',
:owner => 'root',
:group => 'neutron',
@ -77,78 +70,78 @@ describe 'neutron::plugins::cisco' do
end
it 'passes purge to resource plugin_cisco' do
is_expected.to contain_resources('neutron_plugin_cisco').with({
should contain_resources('neutron_plugin_cisco').with({
:purge => false
})
end
it 'passes purge to resource cisco_db_conn' do
is_expected.to contain_resources('neutron_plugin_cisco_db_conn').with({
should contain_resources('neutron_plugin_cisco_db_conn').with({
:purge => false
})
end
it 'passes purge to resource cisco_l2network' do
is_expected.to contain_resources('neutron_plugin_cisco_l2network').with({
should contain_resources('neutron_plugin_cisco_l2network').with({
:purge => false
})
end
it 'passes purge to resource cisco_credentials' do
is_expected.to contain_resources('neutron_plugin_cisco_credentials').with({
should contain_resources('neutron_plugin_cisco_credentials').with({
:purge => false
})
end
it 'should perform default l2 configuration' do
is_expected.to contain_neutron_plugin_cisco_l2network('VLANS/vlan_start').\
should contain_neutron_plugin_cisco_l2network('VLANS/vlan_start').\
with_value(params[:vlan_start])
is_expected.to contain_neutron_plugin_cisco_l2network('VLANS/vlan_end').\
should contain_neutron_plugin_cisco_l2network('VLANS/vlan_end').\
with_value(params[:vlan_end])
is_expected.to contain_neutron_plugin_cisco_l2network('VLANS/vlan_name_prefix').\
should contain_neutron_plugin_cisco_l2network('VLANS/vlan_name_prefix').\
with_value(params[:vlan_name_prefix])
is_expected.to contain_neutron_plugin_cisco_l2network('MODEL/model_class').\
should contain_neutron_plugin_cisco_l2network('MODEL/model_class').\
with_value(params[:model_class])
is_expected.to contain_neutron_plugin_cisco_l2network('PORTS/max_ports').\
should contain_neutron_plugin_cisco_l2network('PORTS/max_ports').\
with_value(params[:max_ports])
is_expected.to contain_neutron_plugin_cisco_l2network('PORTPROFILES/max_port_profiles').\
should contain_neutron_plugin_cisco_l2network('PORTPROFILES/max_port_profiles').\
with_value(params[:max_port_profiles])
is_expected.to contain_neutron_plugin_cisco_l2network('NETWORKS/max_networks').\
should contain_neutron_plugin_cisco_l2network('NETWORKS/max_networks').\
with_value(params[:max_networks])
is_expected.to contain_neutron_plugin_cisco_l2network('SEGMENTATION/manager_class').\
should contain_neutron_plugin_cisco_l2network('SEGMENTATION/manager_class').\
with_value(params[:manager_class])
end
it 'should create a dummy inventory item' do
is_expected.to contain_neutron_plugin_cisco('INVENTORY/dummy').\
should contain_neutron_plugin_cisco('INVENTORY/dummy').\
with_value('dummy')
end
it 'should configure the db connection' do
is_expected.to contain_neutron_plugin_cisco_db_conn('DATABASE/name').\
should contain_neutron_plugin_cisco_db_conn('DATABASE/name').\
with_value(params[:database_name])
is_expected.to contain_neutron_plugin_cisco_db_conn('DATABASE/user').\
should contain_neutron_plugin_cisco_db_conn('DATABASE/user').\
with_value(params[:database_user])
is_expected.to contain_neutron_plugin_cisco_db_conn('DATABASE/pass').\
should contain_neutron_plugin_cisco_db_conn('DATABASE/pass').\
with_value(params[:database_pass])
is_expected.to contain_neutron_plugin_cisco_db_conn('DATABASE/host').\
should contain_neutron_plugin_cisco_db_conn('DATABASE/host').\
with_value(params[:database_host])
end
it 'should configure the admin credentials' do
is_expected.to contain_neutron_plugin_cisco_credentials('keystone/username').\
should contain_neutron_plugin_cisco_credentials('keystone/username').\
with_value(params[:keystone_username])
is_expected.to contain_neutron_plugin_cisco_credentials('keystone/password').\
should contain_neutron_plugin_cisco_credentials('keystone/password').\
with_value(params[:keystone_password])
is_expected.to contain_neutron_plugin_cisco_credentials('keystone/password').with_secret( true )
is_expected.to contain_neutron_plugin_cisco_credentials('keystone/auth_url').\
should contain_neutron_plugin_cisco_credentials('keystone/password').with_secret( true )
should contain_neutron_plugin_cisco_credentials('keystone/auth_url').\
with_value(params[:keystone_auth_url])
is_expected.to contain_neutron_plugin_cisco_credentials('keystone/tenant').\
should contain_neutron_plugin_cisco_credentials('keystone/tenant').\
with_value(params[:keystone_tenant])
end
it 'should perform vswitch plugin configuration' do
is_expected.to contain_neutron_plugin_cisco('PLUGINS/vswitch_plugin').\
should contain_neutron_plugin_cisco('PLUGINS/vswitch_plugin').\
with_value('neutron.plugins.openvswitch.ovs_neutron_plugin.OVSNeutronPluginV2')
end
@ -158,59 +151,38 @@ describe 'neutron::plugins::cisco' do
end
it 'should perform nexus plugin configuration' do
is_expected.to contain_neutron_plugin_cisco('PLUGINS/nexus_plugin').\
should contain_neutron_plugin_cisco('PLUGINS/nexus_plugin').\
with_value('neutron.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin')
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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/cisco/cisco_plugins.ini',
:tag => 'neutron-file-line',
)
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
it_configures 'default cisco plugin'
end
context 'on Debian operating systems' do
before do
facts.merge!({:operatingsystem => 'Debian'})
end
it_configures 'default cisco plugin'
shared_examples 'neutron::plugins::cisco on Ubuntu' do
it 'configures /etc/default/neutron-server' do
should 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/cisco/cisco_plugins.ini',
:tag => 'neutron-file-line',
)
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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 'default cisco plugin'
if facts[:operatingsystem] == 'Ubuntu'
it_behaves_like 'neutron::plugins::cisco on Ubuntu'
end
end
it_configures 'default cisco plugin'
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::midonet' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -12,22 +11,16 @@ describe 'neutron::plugins::midonet' do
let :default_params do
{
:midonet_cluster_ip => '127.0.0.1',
:midonet_cluster_port => '8181',
:keystone_username => 'neutron',
:keystone_password => 'test_midonet',
:keystone_tenant => 'services',
:purge_config => false,
:midonet_cluster_ip => '127.0.0.1',
:midonet_cluster_port => '8181',
:keystone_username => 'neutron',
:keystone_password => 'test_midonet',
:keystone_tenant => 'services',
:purge_config => false,
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron midonet plugin' do
shared_examples 'neutron midonet plugin' do
let :params do
{}
@ -38,84 +31,83 @@ describe 'neutron::plugins::midonet' do
end
it 'should install package python-networking-midonet' do
is_expected.to contain_package('python-networking-midonet').with(
should contain_package('python-networking-midonet').with(
:ensure => 'present')
end
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/midonet/midonet.ini')
is_expected.to contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
should contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
should contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_plugin_midonet').with({
should contain_resources('neutron_plugin_midonet').with({
:purge => false
})
end
it 'should perform default configuration of' do
midonet_uri = "http://" + params[:midonet_cluster_ip] + ":" + params[:midonet_cluster_port] + "/midonet-api";
is_expected.to contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(midonet_uri)
is_expected.to contain_neutron_plugin_midonet('MIDONET/username').with_value(params[:keystone_username])
is_expected.to contain_neutron_plugin_midonet('MIDONET/password').with_value(params[:keystone_password])
is_expected.to contain_neutron_plugin_midonet('MIDONET/project_id').with_value(params[:keystone_tenant])
should contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(midonet_uri)
should contain_neutron_plugin_midonet('MIDONET/username').with_value(params[:keystone_username])
should contain_neutron_plugin_midonet('MIDONET/password').with_value(params[:keystone_password])
should contain_neutron_plugin_midonet('MIDONET/project_id').with_value(params[:keystone_tenant])
end
end
shared_examples_for 'neutron midonet plugin using deprecated params' do
shared_examples 'neutron midonet plugin using deprecated params' do
let :params do
{
:midonet_api_ip => '192.168.0.1',
:midonet_api_port => '8181',
:midonet_api_ip => '192.168.0.1',
:midonet_api_port => '8181',
}
end
before do
params.merge!(default_params)
end
it 'should take into account deprecated parameters first' do
midonet_uri = "http://" + params[:midonet_api_ip] + ":" + params[:midonet_api_port] + "/midonet-api";
is_expected.to contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(midonet_uri)
should contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(midonet_uri)
end
it 'should take into account deprecated parameters first' do
bad_midonet_uri = "http://" + params[:midonet_cluster_ip] + ":" + params[:midonet_cluster_port] + "/midonet-api";
is_expected.to_not contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(bad_midonet_uri)
should_not contain_neutron_plugin_midonet('MIDONET/midonet_uri').with_value(bad_midonet_uri)
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
shared_examples 'neutron midonet plugin on Debian' do
it 'configures /etc/default/neutron-server' do
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
should 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/midonet/midonet.ini',
)
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
it_configures 'neutron midonet plugin'
it_configures 'neutron midonet plugin using deprecated params'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
it_configures 'neutron midonet plugin'
it_configures 'neutron midonet plugin using deprecated params'
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 'neutron midonet plugin'
it_behaves_like 'neutron midonet plugin using deprecated params'
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron midonet plugin on Debian'
end
end
end
end

View File

@ -20,7 +20,6 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::arista::l3' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -46,19 +45,19 @@ describe 'neutron::plugins::ml2::arista::l3' do
}
end
shared_examples_for 'neutron plugin ml2 arista l3_arista' do
shared_examples 'neutron plugin ml2 arista l3_arista' do
before do
params.merge!(default_params)
end
it 'configures ml2 arista l3_arista settings' do
is_expected.to contain_neutron_plugin_ml2('l3_arista/primary_l3_host').with_value(params[:primary_l3_host])
is_expected.to contain_neutron_plugin_ml2('l3_arista/primary_l3_host_username').with_value(params[:primary_l3_host_username])
is_expected.to contain_neutron_plugin_ml2('l3_arista/primary_l3_host_password').with_value(params[:primary_l3_host_password]).with_secret(true)
should contain_neutron_plugin_ml2('l3_arista/primary_l3_host').with_value(params[:primary_l3_host])
should contain_neutron_plugin_ml2('l3_arista/primary_l3_host_username').with_value(params[:primary_l3_host_username])
should contain_neutron_plugin_ml2('l3_arista/primary_l3_host_password').with_value(params[:primary_l3_host_password]).with_secret(true)
end
end
shared_examples_for 'ml2 l3_arista should fail when mlag is true and secondary is service default' do
shared_examples 'ml2 l3_arista should fail when mlag is true and secondary is service default' do
let :params do
{}
end
@ -69,7 +68,7 @@ describe 'neutron::plugins::ml2::arista::l3' do
end
it 'should fail when mlag is true and secondary l3 host is service default' do
is_expected.to raise_error(Puppet::Error, /Must set secondary_l3_host when mlag_config is true./)
should raise_error(Puppet::Error, /Must set secondary_l3_host when mlag_config is true./)
end
end
@ -83,7 +82,7 @@ describe 'neutron::plugins::ml2::arista::l3' do
}))
end
it_configures 'neutron plugin ml2 arista l3_arista'
it_behaves_like 'neutron plugin ml2 arista l3_arista'
end
end
end

View File

@ -20,7 +20,6 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::arista' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -45,15 +44,15 @@ describe 'neutron::plugins::ml2::arista' do
}
end
shared_examples_for 'neutron plugin ml2 arista' do
shared_examples 'neutron plugin ml2 arista' do
before do
params.merge!(default_params)
end
it 'configures ml2 arista settings' do
is_expected.to contain_neutron_plugin_ml2('ml2_arista/eapi_host').with_value(params[:eapi_host])
is_expected.to contain_neutron_plugin_ml2('ml2_arista/eapi_username').with_value(params[:eapi_username])
is_expected.to contain_neutron_plugin_ml2('ml2_arista/eapi_password').with_value(params[:eapi_password]).with_secret(true)
should contain_neutron_plugin_ml2('ml2_arista/eapi_host').with_value(params[:eapi_host])
should contain_neutron_plugin_ml2('ml2_arista/eapi_username').with_value(params[:eapi_username])
should contain_neutron_plugin_ml2('ml2_arista/eapi_password').with_value(params[:eapi_password]).with_secret(true)
end
end
@ -67,7 +66,7 @@ describe 'neutron::plugins::ml2::arista' do
}))
end
it_configures 'neutron plugin ml2 arista'
it_behaves_like 'neutron plugin ml2 arista'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::bagpipe' do
let :default_params do
{
:bagpipe_bgp_port => '<SERVICE DEFAULT>',
@ -11,33 +10,24 @@ describe 'neutron::plugins::ml2::bagpipe' do
end
let :params do
{
}
{}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin bagpipe ml2' do
shared_examples 'neutron plugin bagpipe ml2' do
before do
params.merge!(default_params)
end
it 'should have' do
is_expected.to contain_package('python-networking-bagpipe').with(
should contain_package('python-networking-bagpipe').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
end
it 'configures bagpipe settings' do
is_expected.to contain_neutron_plugin_ml2('bagpipe/bagpipe_bgp_port').with_value(params[:bagpipe_bgp_port])
is_expected.to contain_neutron_plugin_ml2('bagpipe/mpls_bridge').with_value(params[:mpls_bridge])
should contain_neutron_plugin_ml2('bagpipe/bagpipe_bgp_port').with_value(params[:bagpipe_bgp_port])
should contain_neutron_plugin_ml2('bagpipe/mpls_bridge').with_value(params[:mpls_bridge])
end
end
@ -57,7 +47,7 @@ describe 'neutron::plugins::ml2::bagpipe' do
{ :bagpipe_package_name => 'python-networking-bagpipe' }
end
end
it_configures 'neutron plugin bagpipe ml2'
it_behaves_like 'neutron plugin bagpipe ml2'
end
end
end

View File

@ -1,18 +1,14 @@
#
# Unit tests for neutron::plugins::ml2::cisco::nexus class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::bigswitch::restproxy' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :required_params do
@ -26,35 +22,29 @@ describe 'neutron::plugins::ml2::bigswitch::restproxy' do
required_params
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples 'neutron bigswitch ml2 restproxy' do
shared_examples_for 'neutron bigswitch ml2 restproxy' do
it { is_expected.to contain_class('neutron::params') }
it { is_expected.to contain_class('neutron::plugins::ml2::bigswitch') }
it { should contain_class('neutron::params') }
it { should contain_class('neutron::plugins::ml2::bigswitch') }
it do
is_expected.to contain_neutron_plugin_ml2('restproxy/servers').with_value(params[:servers])
is_expected.to contain_neutron_plugin_ml2('restproxy/server_auth').with_value(params[:server_auth])
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_tenant').with_value('service')
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_password').with_value(false)
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_user').with_value('neutron')
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_url').with_value(false)
is_expected.to contain_neutron_plugin_ml2('restproxy/auto_sync_on_failure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/cache_connections').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/consistency_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/keystone_sync_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/neutron_id').with_value('neutron')
is_expected.to contain_neutron_plugin_ml2('restproxy/no_ssl_validation').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/server_ssl').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/server_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/ssl_cert_directory').with_value('/var/lib/neutron')
is_expected.to contain_neutron_plugin_ml2('restproxy/sync_data').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('restproxy/thread_pool_size').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/servers').with_value(params[:servers])
should contain_neutron_plugin_ml2('restproxy/server_auth').with_value(params[:server_auth])
should contain_neutron_plugin_ml2('restproxy/auth_tenant').with_value('service')
should contain_neutron_plugin_ml2('restproxy/auth_password').with_value(false)
should contain_neutron_plugin_ml2('restproxy/auth_user').with_value('neutron')
should contain_neutron_plugin_ml2('restproxy/auth_url').with_value(false)
should contain_neutron_plugin_ml2('restproxy/auto_sync_on_failure').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/cache_connections').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/consistency_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/keystone_sync_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/neutron_id').with_value('neutron')
should contain_neutron_plugin_ml2('restproxy/no_ssl_validation').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/server_ssl').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/server_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/ssl_cert_directory').with_value('/var/lib/neutron')
should contain_neutron_plugin_ml2('restproxy/sync_data').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('restproxy/thread_pool_size').with_value('<SERVICE DEFAULT>')
end
@ -77,37 +67,39 @@ describe 'neutron::plugins::ml2::bigswitch::restproxy' do
it do
is_expected.to contain_neutron_plugin_ml2('restproxy/servers').with_value(params[:servers])
is_expected.to contain_neutron_plugin_ml2('restproxy/server_auth').with_value(params[:server_auth])
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_tenant').with_value('service')
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_password').with_value(false)
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_user').with_value('neutron')
is_expected.to contain_neutron_plugin_ml2('restproxy/auth_url').with_value(false)
is_expected.to contain_neutron_plugin_ml2('restproxy/auto_sync_on_failure').with_value(false)
is_expected.to contain_neutron_plugin_ml2('restproxy/cache_connections').with_value(true)
is_expected.to contain_neutron_plugin_ml2('restproxy/consistency_interval').with_value(10)
is_expected.to contain_neutron_plugin_ml2('restproxy/keystone_sync_interval').with_value(10)
is_expected.to contain_neutron_plugin_ml2('restproxy/neutron_id').with_value('openstack')
is_expected.to contain_neutron_plugin_ml2('restproxy/no_ssl_validation').with_value(true)
is_expected.to contain_neutron_plugin_ml2('restproxy/server_ssl').with_value(false)
is_expected.to contain_neutron_plugin_ml2('restproxy/server_timeout').with_value(30)
is_expected.to contain_neutron_plugin_ml2('restproxy/ssl_cert_directory').with_value('/var/lib/bigswitch')
is_expected.to contain_neutron_plugin_ml2('restproxy/sync_data').with_value(true)
is_expected.to contain_neutron_plugin_ml2('restproxy/thread_pool_size').with_value(8)
should contain_neutron_plugin_ml2('restproxy/servers').with_value(params[:servers])
should contain_neutron_plugin_ml2('restproxy/server_auth').with_value(params[:server_auth])
should contain_neutron_plugin_ml2('restproxy/auth_tenant').with_value('service')
should contain_neutron_plugin_ml2('restproxy/auth_password').with_value(false)
should contain_neutron_plugin_ml2('restproxy/auth_user').with_value('neutron')
should contain_neutron_plugin_ml2('restproxy/auth_url').with_value(false)
should contain_neutron_plugin_ml2('restproxy/auto_sync_on_failure').with_value(false)
should contain_neutron_plugin_ml2('restproxy/cache_connections').with_value(true)
should contain_neutron_plugin_ml2('restproxy/consistency_interval').with_value(10)
should contain_neutron_plugin_ml2('restproxy/keystone_sync_interval').with_value(10)
should contain_neutron_plugin_ml2('restproxy/neutron_id').with_value('openstack')
should contain_neutron_plugin_ml2('restproxy/no_ssl_validation').with_value(true)
should contain_neutron_plugin_ml2('restproxy/server_ssl').with_value(false)
should contain_neutron_plugin_ml2('restproxy/server_timeout').with_value(30)
should contain_neutron_plugin_ml2('restproxy/ssl_cert_directory').with_value('/var/lib/bigswitch')
should contain_neutron_plugin_ml2('restproxy/sync_data').with_value(true)
should contain_neutron_plugin_ml2('restproxy/thread_pool_size').with_value(8)
end
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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_configures 'neutron bigswitch ml2 restproxy'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron bigswitch ml2 restproxy'
end
end
end
end

View File

@ -1,14 +1,14 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::bigswitch' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
@ -21,49 +21,38 @@ describe 'neutron::plugins::ml2::bigswitch' do
{}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin bigswitch ml2' do
shared_examples 'neutron plugin bigswitch ml2' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'should have' do
is_expected.to contain_package('python-networking-bigswitch').with(
should contain_package('python-networking-bigswitch').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
it_configures 'neutron plugin bigswitch ml2'
shared_examples 'neutron plugin bigswitch ml2 on Debian' do
it { should raise_error(Puppet::Error, /Unsupported osfamily Debian/) }
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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 { is_expected.to raise_error(Puppet::Error, /Unsupported osfamily Debian/) }
if facts[:osfamily] == 'Debian'
it_behaves_like 'neutron plugin bigswitch ml2 on Debian'
else
it_behaves_like 'neutron plugin bigswitch ml2'
end
end
end
end

View File

@ -1,18 +1,14 @@
#
# Unit tests for neutron::plugins::ml2::cisco::nexus1000v class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::cisco::nexus1000v' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
@ -37,50 +33,42 @@ describe 'neutron::plugins::ml2::cisco::nexus1000v' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron cisco ml2 nexus1000v plugin' do
shared_examples 'neutron cisco ml2 nexus1000v plugin' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it do
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/n1kv_vsm_ips').with_value(params[:n1kv_vsm_ip])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/username').with_value(params[:n1kv_vsm_username])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/password').with_value(params[:n1kv_vsm_password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/default_policy_profile').with_value(params[:default_policy_profile])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/default_vlan_network_profile').with_value(params[:default_vlan_network_profile])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/default_vxlan_network_profile').with_value(params[:default_vxlan_network_profile])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/poll_duration').with_value(params[:poll_duration])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/http_pool_size').with_value(params[:http_pool_size])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/http_timeout').with_value(params[:http_timeout])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/sync_interval').with_value(params[:sync_interval])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/max_vsm_retries').with_value(params[:max_vsm_retries])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/restrict_policy_profiles').with_value(params[:restrict_policy_profiles])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_n1kv/enable_vif_type_n1kv').with_value(params[:enable_vif_type_n1kv])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/n1kv_vsm_ips').with_value(params[:n1kv_vsm_ip])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/username').with_value(params[:n1kv_vsm_username])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/password').with_value(params[:n1kv_vsm_password]).with_secret(true)
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/default_policy_profile').with_value(params[:default_policy_profile])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/default_vlan_network_profile').with_value(params[:default_vlan_network_profile])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/default_vxlan_network_profile').with_value(params[:default_vxlan_network_profile])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/poll_duration').with_value(params[:poll_duration])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/http_pool_size').with_value(params[:http_pool_size])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/http_timeout').with_value(params[:http_timeout])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/sync_interval').with_value(params[:sync_interval])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/max_vsm_retries').with_value(params[:max_vsm_retries])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/restrict_policy_profiles').with_value(params[:restrict_policy_profiles])
should contain_neutron_plugin_ml2('ml2_cisco_n1kv/enable_vif_type_n1kv').with_value(params[:enable_vif_type_n1kv])
end
end
begin
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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_configures 'neutron cisco ml2 nexus1000v plugin'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron cisco ml2 nexus1000v plugin'
end
end
end
end

View File

@ -1,38 +1,38 @@
#
# Unit tests for neutron::plugins::ml2::cisco::nexus class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::cisco::nexus' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
{
:nexus_config => {
:nexus_config => {
'cvf2leaff2' => {
'username' => 'prad',
"password" => "password",
"ip_address" => "172.18.117.28",
"nve_src_intf" => 1,
"physnet" => "physnet1",
"vpc_pool" => "",
"intfcfg_portchannel" => "",
"https_verify" => false,
'username' => 'prad',
"password" => "password",
"ip_address" => "172.18.117.28",
"nve_src_intf" => 1,
"physnet" => "physnet1",
"vpc_pool" => "",
"intfcfg_portchannel" => "",
"https_verify" => false,
"https_local_certificate" => "",
"servers" => {
"control02" => {"hostname"=> "control02",
"ports" => "portchannel:20"},
"control01" => {"hostname"=> "control01",
"ports" => "portchannel:10"}
"servers" => {
"control02" => {
"hostname" => "control02",
"ports" => "portchannel:20"
},
"control01" => {
"hostname" => "control01",
"ports" => "portchannel:10"
}
}
}
},
@ -48,54 +48,51 @@ describe 'neutron::plugins::ml2::cisco::nexus' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron cisco ml2 nexus plugin' do
shared_examples 'neutron cisco ml2 nexus plugin' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it do
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/managed_physical_network').with_value(params[:managed_physical_network])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/switch_heartbeat_time').with_value(params[:switch_heartbeat_time])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/provider_vlan_auto_create').with_value(params[:provider_vlan_auto_create])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/provider_vlan_auto_trunk').with_value(params[:provider_vlan_auto_trunk])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco/vxlan_global_config').with_value(params[:vxlan_global_config])
should contain_neutron_plugin_ml2('ml2_cisco/managed_physical_network').with_value(params[:managed_physical_network])
should contain_neutron_plugin_ml2('ml2_cisco/switch_heartbeat_time').with_value(params[:switch_heartbeat_time])
should contain_neutron_plugin_ml2('ml2_cisco/provider_vlan_auto_create').with_value(params[:provider_vlan_auto_create])
should contain_neutron_plugin_ml2('ml2_cisco/provider_vlan_auto_trunk').with_value(params[:provider_vlan_auto_trunk])
should contain_neutron_plugin_ml2('ml2_cisco/vxlan_global_config').with_value(params[:vxlan_global_config])
end
it {
# Stored as an array of arrays with the first element consisting of the name and
# the second element consisting of the config hash
params[:nexus_config].each do |switch_config|
is_expected.to contain_neutron__plugins__ml2__cisco__nexus_creds(switch_config.first)
should contain_neutron__plugins__ml2__cisco__nexus_creds(switch_config.first)
end
}
end
begin
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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
let :platform_params do
{ :cisco_ml2_config_file => '/etc/neutron/conf.d/neutron-server/ml2_mech_cisco_nexus.conf' }
let (:platform_params) do
case facts[:osfamily]
when 'RedHat'
{
:cisco_ml2_config_file => '/etc/neutron/conf.d/neutron-server/ml2_mech_cisco_nexus.conf'
}
end
end
it_configures 'neutron cisco ml2 nexus plugin'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron cisco ml2 nexus plugin'
end
end
end
end

View File

@ -1,14 +1,14 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::cisco' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
@ -21,41 +21,32 @@ describe 'neutron::plugins::ml2::cisco' do
{}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron plugin cisco ml2' do
shared_examples 'neutron plugin cisco ml2' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'should have' do
is_expected.to contain_package('python-networking-cisco').with(
should contain_package('python-networking-cisco').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
end
end
begin
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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_configures 'neutron plugin cisco ml2'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron plugin cisco ml2'
end
end
end
end

View File

@ -1,23 +1,19 @@
#
# Unit tests for neutron::plugins::ml2::cisco::type_nexus_vxlan class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::cisco::type_nexus_vxlan' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
{
:vni_ranges => '20000:22000',
:vni_ranges => '20000:22000',
:mcast_ranges => '224.0.0.1:224.0.0.3,224.0.1.1:224.0.1.3'
}
end
@ -26,39 +22,30 @@ describe 'neutron::plugins::ml2::cisco::type_nexus_vxlan' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron cisco ml2 type nexus vxlan plugin' do
shared_examples 'neutron cisco ml2 type nexus vxlan plugin' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it do
is_expected.to contain_neutron_plugin_ml2('ml2_type_nexus_vxlan/vni_ranges').with_value(params[:vni_ranges])
is_expected.to contain_neutron_plugin_ml2('ml2_type_nexus_vxlan/mcast_ranges').with_value(params[:mcast_ranges])
should contain_neutron_plugin_ml2('ml2_type_nexus_vxlan/vni_ranges').with_value(params[:vni_ranges])
should contain_neutron_plugin_ml2('ml2_type_nexus_vxlan/mcast_ranges').with_value(params[:mcast_ranges])
end
end
begin
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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_configures 'neutron cisco ml2 type nexus vxlan plugin'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron cisco ml2 type nexus vxlan plugin'
end
end
end
end

View File

@ -1,18 +1,14 @@
#
# Unit tests for neutron::plugins::ml2::cisco::ucsm class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::cisco::ucsm' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
@ -32,44 +28,35 @@ describe 'neutron::plugins::ml2::cisco::ucsm' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron cisco ml2 ucsm plugin' do
shared_examples 'neutron cisco ml2 ucsm plugin' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it do
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_ip').with_value(params[:ucsm_ip])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_username').with_value(params[:ucsm_username])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_password').with_value(params[:ucsm_password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_host_list').with_value(params[:ucsm_host_list])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_ucsm/supported_pci_devs').with_value(params[:supported_pci_devs])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_ucsm/sp_template_list').with_value(params[:sp_template_list])
is_expected.to contain_neutron_plugin_ml2('ml2_cisco_ucsm/vnic_template_list').with_value(params[:vnic_template_list])
should contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_ip').with_value(params[:ucsm_ip])
should contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_username').with_value(params[:ucsm_username])
should contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_password').with_value(params[:ucsm_password]).with_secret(true)
should contain_neutron_plugin_ml2('ml2_cisco_ucsm/ucsm_host_list').with_value(params[:ucsm_host_list])
should contain_neutron_plugin_ml2('ml2_cisco_ucsm/supported_pci_devs').with_value(params[:supported_pci_devs])
should contain_neutron_plugin_ml2('ml2_cisco_ucsm/sp_template_list').with_value(params[:sp_template_list])
should contain_neutron_plugin_ml2('ml2_cisco_ucsm/vnic_template_list').with_value(params[:vnic_template_list])
end
end
begin
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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_configures 'neutron cisco ml2 ucsm plugin'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron cisco ml2 ucsm plugin'
end
end
end
end

View File

@ -1,83 +1,66 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::cisco::vts' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
{
:vts_timeout => '<SERVICE DEFAULT>',
:vts_sync_timeout => '<SERVICE DEFAULT>',
:vts_retry_count => '<SERVICE DEFAULT>',
:package_ensure => 'present',
:vts_timeout => '<SERVICE DEFAULT>',
:vts_sync_timeout => '<SERVICE DEFAULT>',
:vts_retry_count => '<SERVICE DEFAULT>',
:package_ensure => 'present',
}
end
let :params do
{
:vts_username => 'user',
:vts_password => 'password',
:vts_url => 'http://abc123',
:vts_vmmid => '12345',
:vts_username => 'user',
:vts_password => 'password',
:vts_url => 'http://abc123',
:vts_vmmid => '12345',
}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin ml2 cisco vts' do
shared_examples 'neutron plugin ml2 cisco vts' do
before do
params.merge!(default_params)
end
it 'should have' do
is_expected.to contain_package('python-cisco-controller').with(
should contain_package('python-cisco-controller').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
end
it 'configures ml2_cc cisco_vts settings' do
is_expected.to contain_neutron_plugin_ml2('ml2_cc/password').with_value(params[:vts_password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ml2_cc/username').with_value(params[:vts_username])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/url').with_value(params[:vts_url])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/timeout').with_value(params[:vts_timeout])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/sync_timeout').with_value(params[:vts_sync_timeout])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/retry_count').with_value(params[:vts_retry_count])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/vmm_id').with_value(params[:vts_vmmid])
should contain_neutron_plugin_ml2('ml2_cc/password').with_value(params[:vts_password]).with_secret(true)
should contain_neutron_plugin_ml2('ml2_cc/username').with_value(params[:vts_username])
should contain_neutron_plugin_ml2('ml2_cc/url').with_value(params[:vts_url])
should contain_neutron_plugin_ml2('ml2_cc/timeout').with_value(params[:vts_timeout])
should contain_neutron_plugin_ml2('ml2_cc/sync_timeout').with_value(params[:vts_sync_timeout])
should contain_neutron_plugin_ml2('ml2_cc/retry_count').with_value(params[:vts_retry_count])
should contain_neutron_plugin_ml2('ml2_cc/vmm_id').with_value(params[:vts_vmmid])
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
it_configures 'neutron plugin ml2 cisco vts'
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
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
it_behaves_like 'neutron plugin ml2 cisco vts'
end
it_configures 'neutron plugin ml2 cisco vts'
end
end

View File

@ -1,11 +1,6 @@
#
# Unit tests for neutron::plugins::ml2::fujitsu::cfab class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::fujitsu::cfab' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -31,27 +26,20 @@ describe 'neutron::plugins::ml2::fujitsu::cfab' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron fujitsu ml2 cfab plugin' do
shared_examples 'neutron fujitsu ml2 cfab plugin' do
before do
params.merge!(default_params)
end
it do
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/address').with_value(params[:address])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/username').with_value(params[:username])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/password').with_value(params[:password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/physical_networks').with_value(params[:physical_networks])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/share_pprofile').with_value(params[:share_pprofile])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/pprofile_prefix').with_value(params[:pprofile_prefix])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/save_config').with_value(params[:save_config])
should contain_neutron_plugin_ml2('fujitsu_cfab/address').with_value(params[:address])
should contain_neutron_plugin_ml2('fujitsu_cfab/username').with_value(params[:username])
should contain_neutron_plugin_ml2('fujitsu_cfab/password').with_value(params[:password]).with_secret(true)
should contain_neutron_plugin_ml2('fujitsu_cfab/physical_networks').with_value(params[:physical_networks])
should contain_neutron_plugin_ml2('fujitsu_cfab/share_pprofile').with_value(params[:share_pprofile])
should contain_neutron_plugin_ml2('fujitsu_cfab/pprofile_prefix').with_value(params[:pprofile_prefix])
should contain_neutron_plugin_ml2('fujitsu_cfab/save_config').with_value(params[:save_config])
end
end
@ -64,7 +52,7 @@ describe 'neutron::plugins::ml2::fujitsu::cfab' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron fujitsu ml2 cfab plugin'
it_behaves_like 'neutron fujitsu ml2 cfab plugin'
end
end
end

View File

@ -1,11 +1,6 @@
#
# Unit tests for neutron::plugins::ml2::fujitsu::fossw class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::fujitsu::fossw' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -32,28 +27,21 @@ describe 'neutron::plugins::ml2::fujitsu::fossw' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron fujitsu ml2 fossw plugin' do
shared_examples 'neutron fujitsu ml2 fossw plugin' do
before do
params.merge!(default_params)
end
it do
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/fossw_ips').with_value(params[:fossw_ips])
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/username').with_value(params[:username])
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/password').with_value(params[:password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/port').with_value(params[:port])
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/timeout').with_value(params[:timeout])
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/udp_dest_port').with_value(params[:udp_dest_port])
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/ovsdb_vlanid_range_min').with_value(params[:ovsdb_vlanid_range_min])
is_expected.to contain_neutron_plugin_ml2('fujitsu_fossw/ovsdb_port').with_value(params[:ovsdb_port])
should contain_neutron_plugin_ml2('fujitsu_fossw/fossw_ips').with_value(params[:fossw_ips])
should contain_neutron_plugin_ml2('fujitsu_fossw/username').with_value(params[:username])
should contain_neutron_plugin_ml2('fujitsu_fossw/password').with_value(params[:password]).with_secret(true)
should contain_neutron_plugin_ml2('fujitsu_fossw/port').with_value(params[:port])
should contain_neutron_plugin_ml2('fujitsu_fossw/timeout').with_value(params[:timeout])
should contain_neutron_plugin_ml2('fujitsu_fossw/udp_dest_port').with_value(params[:udp_dest_port])
should contain_neutron_plugin_ml2('fujitsu_fossw/ovsdb_vlanid_range_min').with_value(params[:ovsdb_vlanid_range_min])
should contain_neutron_plugin_ml2('fujitsu_fossw/ovsdb_port').with_value(params[:ovsdb_port])
end
end
@ -66,7 +54,7 @@ describe 'neutron::plugins::ml2::fujitsu::fossw' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron fujitsu ml2 fossw plugin'
it_behaves_like 'neutron fujitsu ml2 fossw plugin'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::fujitsu' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -21,23 +20,15 @@ describe 'neutron::plugins::ml2::fujitsu' do
{}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron plugin fujitsu ml2' do
shared_examples 'neutron plugin fujitsu ml2' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'should have' do
is_expected.to contain_package('python-networking-fujitsu').with(
should contain_package('python-networking-fujitsu').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
@ -52,8 +43,7 @@ describe 'neutron::plugins::ml2::fujitsu' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron plugin fujitsu ml2'
it_behaves_like 'neutron plugin fujitsu ml2'
end
end
end

View File

@ -1,14 +1,14 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::mellanox' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin' }"
core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin'
}"
end
let :default_params do
@ -21,42 +21,32 @@ describe 'neutron::plugins::ml2::mellanox' do
{}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron plugin mellanox ml2' do
shared_examples 'neutron plugin mellanox ml2' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'should have' do
is_expected.to contain_package('python-networking-mlnx').with(
should contain_package('python-networking-mlnx').with(
:ensure => params[:package_ensure],
:tag => ['openstack', 'neutron-package']
)
end
end
begin
context 'on RedHat platforms' do
let :facts do
OSDefaults.get_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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_configures 'neutron plugin mellanox ml2'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron plugin mellanox ml2'
end
end
end
end

View File

@ -1,26 +1,22 @@
#
# Unit tests for neutron::plugins::ml2::midonet class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::midonet' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
{
:midonet_uri => 'http://localhost:8080/midonet-api',
:username => 'admin',
:password => 'passw0rd',
:project_id => 'admin',
:midonet_uri => 'http://localhost:8080/midonet-api',
:username => 'admin',
:password => 'passw0rd',
:project_id => 'admin',
}
end
@ -28,45 +24,41 @@ describe 'neutron::plugins::ml2::midonet' do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron ml2 midonet plugin' do
shared_examples 'neutron ml2 midonet plugin' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it do
is_expected.to contain_neutron_plugin_ml2('MIDONET/midonet_uri').with_value(params[:midonet_uri])
is_expected.to contain_neutron_plugin_ml2('MIDONET/username').with_value(params[:username])
is_expected.to contain_neutron_plugin_ml2('MIDONET/password').with_value(params[:password])
is_expected.to contain_neutron_plugin_ml2('MIDONET/project_id').with_value(params[:project_id])
should contain_neutron_plugin_ml2('MIDONET/midonet_uri').with_value(params[:midonet_uri])
should contain_neutron_plugin_ml2('MIDONET/username').with_value(params[:username])
should contain_neutron_plugin_ml2('MIDONET/password').with_value(params[:password])
should contain_neutron_plugin_ml2('MIDONET/project_id').with_value(params[:project_id])
end
end
begin
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
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
let :platform_params do
{ :midonet_ml2_config_file => '/etc/neutron/conf.d/neutron-server/ml2_mech_midonet.conf' }
let (:platform_params) do
case facts[:osfamily]
when 'RedHat'
{
:midonet_ml2_config_file => '/etc/neutron/conf.d/neutron-server/ml2_mech_midonet.conf'
}
end
end
it_configures 'neutron ml2 midonet plugin'
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron ml2 midonet plugin'
end
end
end
end

View File

@ -1,71 +1,50 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::mellanox::mlnx_sdn_assist' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
{
:sdn_url => '<SERVICE DEFAULT>',
:sdn_url => '<SERVICE DEFAULT>',
}
end
let :params do
{
:sdn_username => 'user',
:sdn_password => 'password',
:sdn_username => 'user',
:sdn_password => 'password',
}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin mellanox ml2 mlnx_sdn_assist' do
shared_examples 'neutron plugin mellanox ml2 mlnx_sdn_assist' do
before do
params.merge!(default_params)
end
it 'configures sdn settings' do
is_expected.to contain_neutron_plugin_ml2('sdn/password').with_value(params[:sdn_password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('sdn/username').with_value(params[:sdn_username])
is_expected.to contain_neutron_plugin_ml2('sdn/url').with_value(params[:sdn_url])
should contain_neutron_plugin_ml2('sdn/password').with_value(params[:sdn_password]).with_secret(true)
should contain_neutron_plugin_ml2('sdn/username').with_value(params[:sdn_username])
should contain_neutron_plugin_ml2('sdn/url').with_value(params[:sdn_url])
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
context 'on RedHat platforms' do
let :facts do
OSDefaults.get_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
it_behaves_like 'neutron plugin mellanox ml2 mlnx_sdn_assist'
end
it_configures 'neutron plugin mellanox ml2 mlnx_sdn_assist'
end
context 'on Debian platforms' do
let :facts do
OSDefaults.get_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
it_configures 'neutron plugin mellanox ml2 mlnx_sdn_assist'
end
end

View File

@ -2,13 +2,8 @@ require 'spec_helper'
describe 'neutron::plugins::ml2::networking_ansible' do
let :default_params do
{ :package_ensure => 'present',
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
{
:package_ensure => 'present',
}
end
@ -27,37 +22,37 @@ describe 'neutron::plugins::ml2::networking_ansible' do
}
end
shared_examples_for 'networking-ansible ml2 plugin' do
shared_examples 'networking-ansible ml2 plugin' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'installs networking-ansible python2-networking-ansible package' do
is_expected.to contain_package('python2-networking-ansible').with(
should contain_package('python2-networking-ansible').with(
:name => platform_params[:networking_ansible_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('python2-networking-ansible').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('python2-networking-ansible').that_notifies('Anchor[neutron::install::end]')
should contain_package('python2-networking-ansible').that_requires('Anchor[neutron::install::begin]')
should contain_package('python2-networking-ansible').that_notifies('Anchor[neutron::install::end]')
end
it {
params[:host_configs].each do |host_config|
is_expected.to contain_neutron__plugins__ml2__networking_ansible_host(host_config.first)
should contain_neutron__plugins__ml2__networking_ansible_host(host_config.first)
is_expected.to contain_neutron_plugin_ml2('ansible:host1/ansible_ssh_pass').with_value('password1')
is_expected.to contain_neutron_plugin_ml2('ansible:host1/ansible_ssh_private_key_file').with_value(nil)
should contain_neutron_plugin_ml2('ansible:host1/ansible_ssh_pass').with_value('password1')
should contain_neutron_plugin_ml2('ansible:host1/ansible_ssh_private_key_file').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_private_key_file').with_value('/path/to/key')
is_expected.to contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_pass').with_value(nil)
should contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_private_key_file').with_value('/path/to/key')
should contain_neutron_plugin_ml2('ansible:host2/ansible_ssh_pass').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host1/mac').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host2/mac').with_value('01:23:45:67:89:AB')
should contain_neutron_plugin_ml2('ansible:host1/mac').with_value(nil)
should contain_neutron_plugin_ml2('ansible:host2/mac').with_value('01:23:45:67:89:AB')
is_expected.to contain_neutron_plugin_ml2('ansible:host1/manage_vlans').with_value(nil)
is_expected.to contain_neutron_plugin_ml2('ansible:host2/manage_vlans').with_value(false)
should contain_neutron_plugin_ml2('ansible:host1/manage_vlans').with_value(nil)
should contain_neutron_plugin_ml2('ansible:host2/manage_vlans').with_value(false)
end
}
end
@ -80,10 +75,9 @@ describe 'neutron::plugins::ml2::networking_ansible' do
it_behaves_like 'networking-ansible ml2 plugin'
when facts[:osfamily] != 'RedHat'
it 'fails with unsupported osfamily' do
is_expected.to raise_error(Puppet::Error, /Unsupported osfamily.*/)
should raise_error(Puppet::Error, /Unsupported osfamily.*/)
end
end
end
end
end

View File

@ -2,13 +2,8 @@ require 'spec_helper'
describe 'neutron::plugins::ml2::networking_baremetal' do
let :default_params do
{ :package_ensure => 'present',
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
{
:package_ensure => 'present',
}
end
@ -16,21 +11,21 @@ describe 'neutron::plugins::ml2::networking_baremetal' do
{}
end
shared_examples_for 'networking-baremetal ml2 plugin' do
shared_examples 'networking-baremetal ml2 plugin' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'installs networking-baremetal python2-networking-baremetal package' do
is_expected.to contain_package('python2-networking-baremetal').with(
should contain_package('python2-networking-baremetal').with(
:name => platform_params[:networking_baremetal_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('python2-networking-baremetal').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('python2-networking-baremetal').that_notifies('Anchor[neutron::install::end]')
should contain_package('python2-networking-baremetal').that_requires('Anchor[neutron::install::begin]')
should contain_package('python2-networking-baremetal').that_notifies('Anchor[neutron::install::end]')
end
end
@ -52,10 +47,9 @@ describe 'neutron::plugins::ml2::networking_baremetal' do
it_behaves_like 'networking-baremetal ml2 plugin'
when facts[:osfamily] != 'RedHat'
it 'fails with unsupported osfamily' do
is_expected.to raise_error(Puppet::Error, /Unsupported osfamily.*/)
should raise_error(Puppet::Error, /Unsupported osfamily.*/)
end
end
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::nuage' do
let :pre_condition do
"class { '::neutron':
core_plugin => 'ml2' }
@ -13,12 +12,6 @@ describe 'neutron::plugins::ml2::nuage' do
mechanism_drivers => ['nuage'] }"
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
let :params do
{
:nuage_vsd_ip => %w(192.168.33.3),
@ -32,22 +25,22 @@ describe 'neutron::plugins::ml2::nuage' do
:nuage_default_allow_non_ip => false,}
end
shared_examples_for 'neutron plugin ml2 nuage' do
shared_examples 'neutron plugin ml2 nuage' do
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'configures neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/core_plugin').with_value('ml2')
should contain_neutron_config('DEFAULT/core_plugin').with_value('ml2')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_plugin_nuage').with({
should contain_resources('neutron_plugin_nuage').with({
:purge => false
})
end
it 'should have a nuage plugin ini file' do
is_expected.to contain_file('/etc/neutron/plugins/nuage/plugin.ini').with(
should contain_file('/etc/neutron/plugins/nuage/plugin.ini').with(
:ensure => 'file',
:owner => 'root',
:group => 'neutron',
@ -56,11 +49,11 @@ describe 'neutron::plugins::ml2::nuage' do
end
it 'should configure plugin.ini' do
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/default_net_partition_name').with_value(params[:nuage_net_partition_name])
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/server').with_value(params[:nuage_vsd_ip])
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/organization').with_value(params[:nuage_vsd_organization])
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/cms_id').with_value(params[:nuage_cms_id])
is_expected.to contain_neutron_plugin_nuage('PLUGIN/default_allow_non_ip').with_value(params[:nuage_default_allow_non_ip])
should contain_neutron_plugin_nuage('RESTPROXY/default_net_partition_name').with_value(params[:nuage_net_partition_name])
should contain_neutron_plugin_nuage('RESTPROXY/server').with_value(params[:nuage_vsd_ip])
should contain_neutron_plugin_nuage('RESTPROXY/organization').with_value(params[:nuage_vsd_organization])
should contain_neutron_plugin_nuage('RESTPROXY/cms_id').with_value(params[:nuage_cms_id])
should contain_neutron_plugin_nuage('PLUGIN/default_allow_non_ip').with_value(params[:nuage_default_allow_non_ip])
end
context 'configure ml2 nuage with wrong core_plugin configuration' do
@ -69,11 +62,11 @@ describe 'neutron::plugins::ml2::nuage' do
core_plugin => 'foo' }"
end
it_raises 'a Puppet::Error', /Nuage should be the mechanism driver in neutron.conf/
it { should raise_error(Puppet::Error, /Nuage should be the mechanism driver in neutron.conf/) }
end
it 'should have a nuage plugin conf file' do
is_expected.to contain_file(platform_params[:nuage_conf_file]).with(
should contain_file(platform_params[:nuage_conf_file]).with(
:ensure => platform_params[:nuage_file_ensure],
:target => platform_params[:nuage_file_target]
)
@ -84,7 +77,7 @@ describe 'neutron::plugins::ml2::nuage' do
params.merge!(:nuage_default_allow_non_ip => true)
end
it 'default_allow_non_ip is set to true' do
is_expected.to contain_neutron_plugin_nuage('PLUGIN/default_allow_non_ip').with_value(true)
should contain_neutron_plugin_nuage('PLUGIN/default_allow_non_ip').with_value(true)
end
end
@ -94,7 +87,7 @@ describe 'neutron::plugins::ml2::nuage' do
mechanism_drivers => ['bar'] }"
end
it_raises 'a Puppet::Error', /Nuage should be the mechanism driver in neutron.conf/
it { should raise_error(Puppet::Error, /Nuage should be the mechanism driver in neutron.conf/) }
end
end
@ -121,7 +114,7 @@ describe 'neutron::plugins::ml2::nuage' do
end
end
it_configures 'neutron plugin ml2 nuage'
it_behaves_like 'neutron plugin ml2 nuage'
end
end
end

View File

@ -1,14 +1,14 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::opendaylight' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
@ -24,66 +24,46 @@ describe 'neutron::plugins::ml2::opendaylight' do
let :params do
{
:odl_username => 'user',
:odl_password => 'password',
:odl_username => 'user',
:odl_password => 'password',
}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin opendaylight ml2' do
shared_examples 'neutron plugin opendaylight ml2' do
before do
params.merge!(default_params)
end
it 'should have' do
is_expected.to contain_package('python-networking-odl').with(
should contain_package('python-networking-odl').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
end
it 'configures ml2_odl settings' do
is_expected.to contain_neutron_plugin_ml2('ml2_odl/password').with_value(params[:odl_password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ml2_odl/username').with_value(params[:odl_username])
is_expected.to contain_neutron_plugin_ml2('ml2_odl/url').with_value(params[:odl_url])
is_expected.to contain_neutron_plugin_ml2('ml2_odl/port_binding_controller').with_value(params[:port_binding_controller])
is_expected.to contain_neutron_plugin_ml2('ml2_odl/odl_hostconf_uri').with_value(params[:odl_hostconf_uri])
is_expected.to contain_neutron_plugin_ml2('ml2_odl/odl_features').with_value(params[:odl_features])
should contain_neutron_plugin_ml2('ml2_odl/password').with_value(params[:odl_password]).with_secret(true)
should contain_neutron_plugin_ml2('ml2_odl/username').with_value(params[:odl_username])
should contain_neutron_plugin_ml2('ml2_odl/url').with_value(params[:odl_url])
should contain_neutron_plugin_ml2('ml2_odl/port_binding_controller').with_value(params[:port_binding_controller])
should contain_neutron_plugin_ml2('ml2_odl/odl_hostconf_uri').with_value(params[:odl_hostconf_uri])
should contain_neutron_plugin_ml2('ml2_odl/odl_features').with_value(params[:odl_features])
end
it 'configures neutron server settings' do
is_expected.to contain_neutron_config('OVS/ovsdb_connection').with_value(params[:ovsdb_connection])
should contain_neutron_config('OVS/ovsdb_connection').with_value(params[:ovsdb_connection])
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
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
it_behaves_like 'neutron plugin opendaylight ml2'
end
it_configures 'neutron plugin opendaylight ml2'
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
it_configures 'neutron plugin opendaylight ml2'
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::ovn' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -23,13 +22,7 @@ describe 'neutron::plugins::ml2::ovn' do
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron ovn plugin' do
shared_examples 'neutron ovn plugin' do
let :params do
{}
@ -40,19 +33,19 @@ describe 'neutron::plugins::ml2::ovn' do
end
it 'should perform default configuration of' do
is_expected.to contain_neutron_plugin_ml2('ovn/ovn_nb_connection').with_value(params[:ovn_nb_connection])
is_expected.to contain_neutron_plugin_ml2('ovn/ovn_sb_connection').with_value(params[:ovn_sb_connection])
is_expected.to contain_neutron_plugin_ml2('ovn/ovsdb_connection_timeout').with_value(params[:ovsdb_connection_timeout])
is_expected.to contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(params[:neutron_sync_mode])
is_expected.to contain_neutron_plugin_ml2('ovn/ovn_l3_mode').with_value(params[:ovn_l3_mode])
is_expected.to contain_neutron_plugin_ml2('ovn/vif_type').with_value(params[:vif_type])
is_expected.to contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(params[:dvr_enabled])
is_expected.to contain_neutron_plugin_ml2('ovn/dns_servers').with_value(params[:dns_servers].join(','))
should contain_neutron_plugin_ml2('ovn/ovn_nb_connection').with_value(params[:ovn_nb_connection])
should contain_neutron_plugin_ml2('ovn/ovn_sb_connection').with_value(params[:ovn_sb_connection])
should contain_neutron_plugin_ml2('ovn/ovsdb_connection_timeout').with_value(params[:ovsdb_connection_timeout])
should contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(params[:neutron_sync_mode])
should contain_neutron_plugin_ml2('ovn/ovn_l3_mode').with_value(params[:ovn_l3_mode])
should contain_neutron_plugin_ml2('ovn/vif_type').with_value(params[:vif_type])
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(params[:dvr_enabled])
should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(params[:dns_servers].join(','))
end
end
shared_examples_for 'Validating parameters' do
shared_examples 'Validating parameters' do
let :params do
{}
end
@ -64,14 +57,14 @@ describe 'neutron::plugins::ml2::ovn' do
it 'should fail with invalid neutron_sync_mode' do
params[:neutron_sync_mode] = 'invalid'
is_expected.to raise_error(Puppet::Error, /Invalid value for neutron_sync_mode parameter/)
should raise_error(Puppet::Error, /Invalid value for neutron_sync_mode parameter/)
end
it 'should fail with invalid vif_type' do
params[:vif_type] = 'invalid'
is_expected.to raise_error(Puppet::Error, /Invalid value for vif_type parameter/)
should raise_error(Puppet::Error, /Invalid value for vif_type parameter/)
params.delete(:vif_type)
is_expected.to contain_neutron_plugin_ml2('ovn/vif_type').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ovn/vif_type').with_value('<SERVICE DEFAULT>')
end
context 'with DVR' do
@ -79,7 +72,7 @@ describe 'neutron::plugins::ml2::ovn' do
params.merge!(:dvr_enabled => true)
end
it 'should enable DVR mode' do
is_expected.to contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(params[:dvr_enabled])
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(params[:dvr_enabled])
end
end
end
@ -92,8 +85,8 @@ describe 'neutron::plugins::ml2::ovn' do
facts.merge(OSDefaults.get_facts({:processorcount => 8}))
end
it_configures 'neutron ovn plugin'
it_configures 'Validating parameters'
it_behaves_like 'neutron ovn plugin'
it_behaves_like 'Validating parameters'
end
end
end

View File

@ -21,14 +21,15 @@
require 'spec_helper'
describe 'neutron::plugins::ml2' do
let :pre_condition do
"class { 'neutron':
core_plugin => 'ml2' }"
core_plugin => 'ml2'
}"
end
let :default_params do
{ :type_drivers => ['local', 'flat', 'vlan', 'gre', 'vxlan', 'geneve'],
{
:type_drivers => ['local', 'flat', 'vlan', 'gre', 'vxlan', 'geneve'],
:tenant_network_types => ['local', 'flat', 'vlan', 'gre', 'vxlan'],
:mechanism_drivers => ['openvswitch', 'linuxbridge'],
:flat_networks => '*',
@ -39,12 +40,7 @@ describe 'neutron::plugins::ml2' do
:path_mtu => '0',
:physical_network_mtus => '',
:package_ensure => 'present',
:purge_config => false, }
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
:purge_config => false,
}
end
@ -52,37 +48,37 @@ describe 'neutron::plugins::ml2' do
{}
end
shared_examples_for 'neutron plugin ml2' do
shared_examples 'neutron plugin ml2' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'configures neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/core_plugin').with_value('ml2')
should contain_neutron_config('DEFAULT/core_plugin').with_value('ml2')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_plugin_ml2').with({
should contain_resources('neutron_plugin_ml2').with({
:purge => false
})
end
it 'configures ml2_conf.ini' do
is_expected.to contain_neutron_plugin_ml2('ml2/type_drivers').with_value(p[:type_drivers].join(','))
is_expected.to contain_neutron_plugin_ml2('ml2/tenant_network_types').with_value(p[:tenant_network_types].join(','))
is_expected.to contain_neutron_plugin_ml2('ml2/mechanism_drivers').with_value(p[:mechanism_drivers].join(','))
is_expected.to contain_neutron_plugin_ml2('ml2/extension_drivers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('ml2/path_mtu').with_value(p[:path_mtu])
is_expected.to contain_neutron_plugin_ml2('ml2/physical_network_mtus').with_ensure('absent')
is_expected.to contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('securitygroup/firewall_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('securitygroup/enable_security_group').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ml2/type_drivers').with_value(p[:type_drivers].join(','))
should contain_neutron_plugin_ml2('ml2/tenant_network_types').with_value(p[:tenant_network_types].join(','))
should contain_neutron_plugin_ml2('ml2/mechanism_drivers').with_value(p[:mechanism_drivers].join(','))
should contain_neutron_plugin_ml2('ml2/extension_drivers').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ml2/path_mtu').with_value(p[:path_mtu])
should contain_neutron_plugin_ml2('ml2/physical_network_mtus').with_ensure('absent')
should contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('securitygroup/firewall_driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('securitygroup/enable_security_group').with_value('<SERVICE DEFAULT>')
end
it 'creates plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/ml2/ml2_conf.ini'
)
@ -90,17 +86,16 @@ describe 'neutron::plugins::ml2' do
it 'installs ml2 package (if any)' do
if platform_params.has_key?(:ml2_server_package)
is_expected.to contain_package('neutron-plugin-ml2').with(
should contain_package('neutron-plugin-ml2').with(
:name => platform_params[:ml2_server_package],
:ensure => p[:package_ensure],
:tag => ['neutron-package', 'openstack'],
)
is_expected.to contain_package('neutron-plugin-ml2').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron-plugin-ml2').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron-plugin-ml2').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron-plugin-ml2').that_notifies('Anchor[neutron::install::end]')
end
end
context 'when overriding security group options' do
before :each do
params.merge!(
@ -109,8 +104,8 @@ describe 'neutron::plugins::ml2' do
)
end
it 'configures enable_security_group and firewall_driver options' do
is_expected.to contain_neutron_plugin_ml2('securitygroup/enable_security_group').with_value('true')
is_expected.to contain_neutron_plugin_ml2('securitygroup/firewall_driver').with_value('iptables_hybrid')
should contain_neutron_plugin_ml2('securitygroup/enable_security_group').with_value('true')
should contain_neutron_plugin_ml2('securitygroup/firewall_driver').with_value('iptables_hybrid')
end
end
@ -119,7 +114,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:overlay_ip_version => 4)
end
it 'configures as IPv4' do
is_expected.to contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value(4)
should contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value(4)
end
end
@ -128,7 +123,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:overlay_ip_version => 6)
end
it 'configures as IPv6' do
is_expected.to contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value(6)
should contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value(6)
end
end
@ -137,7 +132,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:overlay_ip_version => 10)
end
it 'fails to accept value' do
is_expected.to raise_error(Puppet::Error)
should raise_error(Puppet::Error)
end
end
@ -147,7 +142,7 @@ describe 'neutron::plugins::ml2' do
end
it 'configures extension drivers' do
is_expected.to contain_neutron_plugin_ml2('ml2/extension_drivers').with_value(p[:extension_drivers].join(','))
should contain_neutron_plugin_ml2('ml2/extension_drivers').with_value(p[:extension_drivers].join(','))
end
end
@ -163,7 +158,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:flat_networks => ['eth1', 'eth2'])
end
it 'configures flat_networks' do
is_expected.to contain_neutron_plugin_ml2('ml2_type_flat/flat_networks').with_value(p[:flat_networks].join(','))
should contain_neutron_plugin_ml2('ml2_type_flat/flat_networks').with_value(p[:flat_networks].join(','))
end
end
@ -172,7 +167,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:tunnel_id_ranges => ['0:20', '40:60'])
end
it 'configures gre_networks with valid ranges' do
is_expected.to contain_neutron_plugin_ml2('ml2_type_gre/tunnel_id_ranges').with_value(p[:tunnel_id_ranges].join(','))
should contain_neutron_plugin_ml2('ml2_type_gre/tunnel_id_ranges').with_value(p[:tunnel_id_ranges].join(','))
end
end
@ -181,7 +176,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:tunnel_id_ranges => ['0:20', '40:100000000'])
end
it_raises 'a Puppet::Error', /tunnel id ranges are to large./
it { should raise_error(Puppet::Error, /tunnel id ranges are to large./) }
end
context 'when using vlan driver with valid values' do
@ -189,7 +184,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:network_vlan_ranges => ['1:20', '400:4094'])
end
it 'configures vlan_networks with 1:20 and 400:4094 VLAN ranges' do
is_expected.to contain_neutron_plugin_ml2('ml2_type_vlan/network_vlan_ranges').with_value(p[:network_vlan_ranges].join(','))
should contain_neutron_plugin_ml2('ml2_type_vlan/network_vlan_ranges').with_value(p[:network_vlan_ranges].join(','))
end
end
@ -198,7 +193,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:network_vlan_ranges => ['1:20', '400:4099'])
end
it_raises 'a Puppet::Error', /vlan id are invalid./
it { should raise_error(Puppet::Error, /vlan id are invalid./) }
end
context 'when using vlan driver with invalid vlan range' do
@ -206,7 +201,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:network_vlan_ranges => ['2938:1'])
end
it_raises 'a Puppet::Error', /vlan ranges are invalid./
it { should raise_error(Puppet::Error, /vlan ranges are invalid./) }
end
context 'when using vxlan driver with valid values' do
@ -214,8 +209,8 @@ describe 'neutron::plugins::ml2' do
params.merge!(:vni_ranges => ['40:300', '500:1000'], :vxlan_group => '224.1.1.1')
end
it 'configures vxlan_networks with 224.1.1.1 vxlan group' do
is_expected.to contain_neutron_plugin_ml2('ml2_type_vxlan/vni_ranges').with_value(p[:vni_ranges].join(','))
is_expected.to contain_neutron_plugin_ml2('ml2_type_vxlan/vxlan_group').with_value(p[:vxlan_group])
should contain_neutron_plugin_ml2('ml2_type_vxlan/vni_ranges').with_value(p[:vni_ranges].join(','))
should contain_neutron_plugin_ml2('ml2_type_vxlan/vxlan_group').with_value(p[:vxlan_group])
end
end
@ -224,7 +219,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:vxlan_group => '192.1.1.1')
end
it_raises 'a Puppet::Error', /is not valid for vxlan_group./
it { should raise_error(Puppet::Error, /is not valid for vxlan_group./) }
end
context 'when using vxlan driver with invalid vni_range' do
@ -232,7 +227,7 @@ describe 'neutron::plugins::ml2' do
params.merge!(:vni_ranges => ['2938:1'])
end
it_raises 'a Puppet::Error', /vni ranges are invalid./
it { should raise_error(Puppet::Error, /vni ranges are invalid./) }
end
context 'when using geneve driver' do
@ -244,9 +239,9 @@ describe 'neutron::plugins::ml2' do
end
it 'configures geneve with valid values' do
is_expected.to contain_neutron_plugin_ml2('ml2/type_drivers').with_value(p[:type_drivers].join(','))
is_expected.to contain_neutron_plugin_ml2('ml2_type_geneve/vni_ranges').with_value([p[:vni_ranges].join(',')])
is_expected.to contain_neutron_plugin_ml2('ml2_type_geneve/max_header_size').with_value(p[:max_header_size])
should contain_neutron_plugin_ml2('ml2/type_drivers').with_value(p[:type_drivers].join(','))
should contain_neutron_plugin_ml2('ml2_type_geneve/vni_ranges').with_value([p[:vni_ranges].join(',')])
should contain_neutron_plugin_ml2('ml2_type_geneve/max_header_size').with_value(p[:max_header_size])
end
end
@ -256,7 +251,7 @@ describe 'neutron::plugins::ml2' do
end
it 'should set the path_mtu on the ml2 plugin' do
is_expected.to contain_neutron_plugin_ml2('ml2/path_mtu').with_value(p[:path_mtu])
should contain_neutron_plugin_ml2('ml2/path_mtu').with_value(p[:path_mtu])
end
end
@ -266,7 +261,7 @@ describe 'neutron::plugins::ml2' do
end
it 'should set the physical_network_mtus on the ml2 plugin' do
is_expected.to contain_neutron_plugin_ml2('ml2/physical_network_mtus').with_value(p[:physical_network_mtus].join(','))
should contain_neutron_plugin_ml2('ml2/physical_network_mtus').with_value(p[:physical_network_mtus].join(','))
end
end
@ -276,7 +271,7 @@ describe 'neutron::plugins::ml2' do
end
it 'overrides package ensure state (if possible)' do
if platform_params.has_key?(:ml2_server_package)
is_expected.to contain_package('neutron-plugin-ml2').with(
should contain_package('neutron-plugin-ml2').with(
:name => platform_params[:ml2_server_package],
:ensure => params[:package_ensure],
:tag => ['neutron-package', 'openstack'],
@ -291,61 +286,43 @@ describe 'neutron::plugins::ml2' do
end
it 'configures /etc/default/neutron-server' do
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
should 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/plugin.ini',
)
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
let :platform_params do
{}
end
context 'on Ubuntu operating systems' do
before do
facts.merge!({:operatingsystem => 'Ubuntu'})
platform_params.merge!(:ml2_server_package => 'neutron-plugin-ml2')
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_configures 'neutron plugin ml2'
end
context 'on non-Ubuntu operating systems' do
before do
facts.merge!({:operatingsystem => 'Debian'})
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
if facts[:operatingsystem] == 'Ubuntu'
{
:ml2_server_package => 'neutron-plugin-ml2'
}
else
{}
end
when 'RedHat'
{
:ml2_server_package => 'openstack-neutron-ml2'
}
end
end
it_configures 'neutron plugin ml2'
it_behaves_like 'neutron plugin ml2'
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
let :platform_params do
{ :ml2_server_package => 'openstack-neutron-ml2' }
end
it_configures 'neutron plugin ml2'
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::vpp' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -23,24 +22,16 @@ describe 'neutron::plugins::ml2::vpp' do
}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin vpp ml2' do
shared_examples 'neutron plugin vpp ml2' do
before do
params.merge!(default_params)
end
it 'configures ml2_vpp settings' do
is_expected.to contain_neutron_plugin_ml2('ml2_vpp/etcd_host').with_value(params[:etcd_host])
is_expected.to contain_neutron_plugin_ml2('ml2_vpp/etcd_port').with_value(params[:etcd_port])
is_expected.to contain_neutron_plugin_ml2('ml2_vpp/etcd_user').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_ml2('ml2_vpp/etcd_pass').with_value('<SERVICE DEFAULT>').with_secret(true)
should contain_neutron_plugin_ml2('ml2_vpp/etcd_host').with_value(params[:etcd_host])
should contain_neutron_plugin_ml2('ml2_vpp/etcd_port').with_value(params[:etcd_port])
should contain_neutron_plugin_ml2('ml2_vpp/etcd_user').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_ml2('ml2_vpp/etcd_pass').with_value('<SERVICE DEFAULT>').with_secret(true)
end
context 'when enabling etcd authentication' do
@ -49,8 +40,8 @@ describe 'neutron::plugins::ml2::vpp' do
:etcd_pass => 'password' )
end
it 'should configure etcd username and password' do
is_expected.to contain_neutron_plugin_ml2('ml2_vpp/etcd_user').with_value('admin')
is_expected.to contain_neutron_plugin_ml2('ml2_vpp/etcd_pass').with_value('password').with_secret(true)
should contain_neutron_plugin_ml2('ml2_vpp/etcd_user').with_value('admin')
should contain_neutron_plugin_ml2('ml2_vpp/etcd_pass').with_value('password').with_secret(true)
end
end
end
@ -63,7 +54,7 @@ describe 'neutron::plugins::ml2::vpp' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron plugin vpp ml2'
it_behaves_like 'neutron plugin vpp ml2'
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::nsx' do
let :pre_condition do
"class { 'neutron':
core_plugin => 'vmware_nsx.plugin.NsxV3Plugin' }
@ -29,13 +28,13 @@ describe 'neutron::plugins::nsx' do
}
end
shared_examples_for 'neutron plugin nsx' do
shared_examples 'neutron plugin nsx' do
context 'with defaults' do
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'should have a nsx plugin ini file' do
is_expected.to contain_file('/etc/neutron/plugins/vmware/nsx.ini').with(
should contain_file('/etc/neutron/plugins/vmware/nsx.ini').with(
:ensure => 'file',
:owner => 'root',
:group => 'neutron',
@ -44,26 +43,26 @@ describe 'neutron::plugins::nsx' do
end
it 'should configure neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/core_plugin').with_value('vmware_nsx.plugin.NsxV3Plugin')
should contain_neutron_config('DEFAULT/core_plugin').with_value('vmware_nsx.plugin.NsxV3Plugin')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_plugin_nsx').with({
should contain_resources('neutron_plugin_nsx').with({
:purge => false
})
end
it 'should configure nsx.ini' do
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_overlay_tz').with_value(default_params[:default_overlay_tz])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_vlan_tz').with_value(default_params[:default_vlan_tz])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_bridge_cluster').with_value(default_params[:default_bridge_cluster])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_tier0_router').with_value(default_params[:default_tier0_router])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/nsx_api_managers').with_value(default_params[:nsx_api_managers])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/nsx_api_password').with_value(default_params[:nsx_api_password])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/dhcp_profile').with_value(default_params[:dhcp_profile])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/dhcp_relay_service').with_value(default_params[:dhcp_relay_service])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/metadata_proxy').with_value(default_params[:metadata_proxy])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/native_dhcp_metadata').with_value(default_params[:native_dhcp_metadata])
should contain_neutron_plugin_nsx('nsx_v3/default_overlay_tz').with_value(default_params[:default_overlay_tz])
should contain_neutron_plugin_nsx('nsx_v3/default_vlan_tz').with_value(default_params[:default_vlan_tz])
should contain_neutron_plugin_nsx('nsx_v3/default_bridge_cluster').with_value(default_params[:default_bridge_cluster])
should contain_neutron_plugin_nsx('nsx_v3/default_tier0_router').with_value(default_params[:default_tier0_router])
should contain_neutron_plugin_nsx('nsx_v3/nsx_api_managers').with_value(default_params[:nsx_api_managers])
should contain_neutron_plugin_nsx('nsx_v3/nsx_api_password').with_value(default_params[:nsx_api_password])
should contain_neutron_plugin_nsx('nsx_v3/dhcp_profile').with_value(default_params[:dhcp_profile])
should contain_neutron_plugin_nsx('nsx_v3/dhcp_relay_service').with_value(default_params[:dhcp_relay_service])
should contain_neutron_plugin_nsx('nsx_v3/metadata_proxy').with_value(default_params[:metadata_proxy])
should contain_neutron_plugin_nsx('nsx_v3/native_dhcp_metadata').with_value(default_params[:native_dhcp_metadata])
end
end
@ -86,17 +85,17 @@ describe 'neutron::plugins::nsx' do
end
it {
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_overlay_tz').with_value(params[:default_overlay_tz])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_vlan_tz').with_value(params[:default_vlan_tz])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_bridge_cluster').with_value(params[:default_bridge_cluster])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/default_tier0_router').with_value(params[:default_tier0_router])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/nsx_api_managers').with_value(params[:nsx_api_managers])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/nsx_api_password').with_value(params[:nsx_api_password])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/dhcp_profile').with_value(params[:dhcp_profile])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/dhcp_relay_service').with_value(params[:dhcp_relay_service])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/metadata_proxy').with_value(params[:metadata_proxy])
is_expected.to contain_neutron_plugin_nsx('nsx_v3/native_dhcp_metadata').with_value(params[:native_dhcp_metadata])
is_expected.to contain_resources('neutron_plugin_nsx').with({
should contain_neutron_plugin_nsx('nsx_v3/default_overlay_tz').with_value(params[:default_overlay_tz])
should contain_neutron_plugin_nsx('nsx_v3/default_vlan_tz').with_value(params[:default_vlan_tz])
should contain_neutron_plugin_nsx('nsx_v3/default_bridge_cluster').with_value(params[:default_bridge_cluster])
should contain_neutron_plugin_nsx('nsx_v3/default_tier0_router').with_value(params[:default_tier0_router])
should contain_neutron_plugin_nsx('nsx_v3/nsx_api_managers').with_value(params[:nsx_api_managers])
should contain_neutron_plugin_nsx('nsx_v3/nsx_api_password').with_value(params[:nsx_api_password])
should contain_neutron_plugin_nsx('nsx_v3/dhcp_profile').with_value(params[:dhcp_profile])
should contain_neutron_plugin_nsx('nsx_v3/dhcp_relay_service').with_value(params[:dhcp_relay_service])
should contain_neutron_plugin_nsx('nsx_v3/metadata_proxy').with_value(params[:metadata_proxy])
should contain_neutron_plugin_nsx('nsx_v3/native_dhcp_metadata').with_value(params[:native_dhcp_metadata])
should contain_resources('neutron_plugin_nsx').with({
:purge => true
})
}
@ -108,28 +107,28 @@ describe 'neutron::plugins::nsx' do
core_plugin => 'foo' }"
end
it_raises 'a Puppet::Error', /NSX plugin should be the core_plugin in neutron.conf/
it { should raise_error(Puppet::Error, /NSX plugin should be the core_plugin in neutron.conf/) }
end
end
shared_examples_for 'neutron plugin nsx on Debian' do
shared_examples 'neutron plugin nsx on Debian' do
context 'with defaults' do
it 'configures /etc/default/neutron-server' do
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
should 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/vmware/nsx.ini',
)
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
end
end
shared_examples_for 'neutron plugin nsx on RedHat' do
shared_examples 'neutron plugin nsx on RedHat' do
context 'with defaults' do
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/vmware/nsx.ini')
end
@ -144,9 +143,8 @@ describe 'neutron::plugins::nsx' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron plugin nsx'
it_configures "neutron plugin nsx on #{facts[:osfamily]}"
it_behaves_like 'neutron plugin nsx'
it_behaves_like "neutron plugin nsx on #{facts[:osfamily]}"
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::nuage' do
let :pre_condition do
"class { 'neutron':
core_plugin => 'nuage_neutron.plugins.nuage.plugin.NuagePlugin' }
@ -11,30 +10,24 @@ describe 'neutron::plugins::nuage' do
class { 'neutron::server': }"
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
let :params do
{
:nuage_vsd_ip => %w(192.168.33.3),
:nuage_vsd_username => 'test',
:nuage_vsd_password => 'test',
:nuage_vsd_organization => 'vsd',
:nuage_net_partition_name => 'test',
:nuage_base_uri_version => 'v3.0',
:nuage_cms_id => '7488fae2-7e51-11e5-8bcf-feff819cdc9f',
:purge_config => false,
}
end
let :params do
{
:nuage_vsd_ip => %w(192.168.33.3),
:nuage_vsd_username => 'test',
:nuage_vsd_password => 'test',
:nuage_vsd_organization => 'vsd',
:nuage_net_partition_name => 'test',
:nuage_base_uri_version => 'v3.0',
:nuage_cms_id => '7488fae2-7e51-11e5-8bcf-feff819cdc9f',
:purge_config => false,}
end
shared_examples_for 'neutron plugin nuage' do
it { is_expected.to contain_class('neutron::params') }
shared_examples 'neutron plugin nuage' do
it { should contain_class('neutron::params') }
it 'should have a nuage plugin ini file' do
is_expected.to contain_file('/etc/neutron/plugins/nuage/plugin.ini').with(
should contain_file('/etc/neutron/plugins/nuage/plugin.ini').with(
:ensure => 'file',
:owner => 'root',
:group => 'neutron',
@ -43,20 +36,20 @@ describe 'neutron::plugins::nuage' do
end
it 'should configure neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/core_plugin').with_value('nuage_neutron.plugins.nuage.plugin.NuagePlugin')
should contain_neutron_config('DEFAULT/core_plugin').with_value('nuage_neutron.plugins.nuage.plugin.NuagePlugin')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_plugin_nuage').with({
should contain_resources('neutron_plugin_nuage').with({
:purge => false
})
end
it 'should configure plugin.ini' do
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/default_net_partition_name').with_value(params[:nuage_net_partition_name])
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/server').with_value(params[:nuage_vsd_ip])
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/organization').with_value(params[:nuage_vsd_organization])
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/cms_id').with_value(params[:nuage_cms_id])
should contain_neutron_plugin_nuage('RESTPROXY/default_net_partition_name').with_value(params[:nuage_net_partition_name])
should contain_neutron_plugin_nuage('RESTPROXY/server').with_value(params[:nuage_vsd_ip])
should contain_neutron_plugin_nuage('RESTPROXY/organization').with_value(params[:nuage_vsd_organization])
should contain_neutron_plugin_nuage('RESTPROXY/cms_id').with_value(params[:nuage_cms_id])
end
context 'configure nuage with wrong core_plugin configure' do
@ -65,72 +58,40 @@ describe 'neutron::plugins::nuage' do
core_plugin => 'foo' }"
end
it_raises 'a Puppet::Error', /Nuage plugin should be the core_plugin in neutron.conf/
end
end
begin
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
it_configures 'neutron plugin nuage'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
it_configures 'neutron plugin nuage'
end
end
begin
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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/nuage/plugin.ini',
)
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
it_configures 'neutron plugin nuage'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/nuage/plugin.ini')
end
it_configures 'neutron plugin nuage'
it { should raise_error(Puppet::Error, /Nuage plugin should be the core_plugin in neutron.conf/) }
end
end
shared_examples 'neutron::plugin::nuage on Debian' do
it 'configures /etc/default/neutron-server' do
should 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/nuage/plugin.ini',
)
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
end
shared_examples 'neutron::plugin::nuage on RedHat' do
it 'should create plugin symbolic link' do
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/nuage/plugin.ini')
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 'neutron plugin nuage'
it_behaves_like "neutron::plugin::nuage on #{facts[:osfamily]}"
end
end
end

View File

@ -1,46 +1,44 @@
require 'spec_helper'
describe 'neutron::plugins::nvp' do
let :pre_condition do
"class { 'neutron':
core_plugin => 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2' }"
core_plugin => 'neutron.plugins.nicira.NeutronPlugin.NvpPluginV2'
}"
end
let :default_params do
{
:metadata_mode => 'access_network',
:package_ensure => 'present',
:purge_config => false,}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
:metadata_mode => 'access_network',
:package_ensure => 'present',
:purge_config => false,
}
end
let :params do
{
:default_tz_uuid => '0344130f-1add-4e86-b36e-ad1c44fe40dc',
:nvp_controllers => %w(10.0.0.1 10.0.0.2),
:nvp_user => 'admin',
:nvp_password => 'password'}
:default_tz_uuid => '0344130f-1add-4e86-b36e-ad1c44fe40dc',
:nvp_controllers => %w(10.0.0.1 10.0.0.2),
:nvp_user => 'admin',
:nvp_password => 'password'
}
end
let :optional_params do
{:default_l3_gw_service_uuid => '0344130f-1add-4e86-b36e-ad1c44fe40dc'}
{
:default_l3_gw_service_uuid => '0344130f-1add-4e86-b36e-ad1c44fe40dc'
}
end
shared_examples_for 'neutron plugin nvp' do
shared_examples 'neutron plugin nvp' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::params') }
it { should contain_class('neutron::params') }
it 'should have' do
is_expected.to contain_package('neutron-plugin-nvp').with(
should contain_package('neutron-plugin-nvp').with(
:name => platform_params[:nvp_server_package],
:ensure => p[:package_ensure],
:tag => ['neutron-package', 'openstack'],
@ -48,32 +46,32 @@ describe 'neutron::plugins::nvp' do
end
it 'should configure neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/core_plugin').with_value('neutron.plugins.nicira.NeutronPlugin.NvpPluginV2')
should contain_neutron_config('DEFAULT/core_plugin').with_value('neutron.plugins.nicira.NeutronPlugin.NvpPluginV2')
end
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/nicira/nvp.ini',
)
is_expected.to contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
should contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
should contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_plugin_nvp').with({
should contain_resources('neutron_plugin_nvp').with({
:purge => false
})
end
it 'should configure nvp.ini' do
is_expected.to contain_neutron_plugin_nvp('DEFAULT/default_tz_uuid').with_value(p[:default_tz_uuid])
is_expected.to contain_neutron_plugin_nvp('nvp/metadata_mode').with_value(p[:metadata_mode])
is_expected.to contain_neutron_plugin_nvp('DEFAULT/nvp_controllers').with_value(p[:nvp_controllers].join(','))
is_expected.to contain_neutron_plugin_nvp('DEFAULT/nvp_user').with_value(p[:nvp_user])
is_expected.to contain_neutron_plugin_nvp('DEFAULT/nvp_password').with_value(p[:nvp_password])
is_expected.to contain_neutron_plugin_nvp('DEFAULT/nvp_password').with_secret( true )
is_expected.not_to contain_neutron_plugin_nvp('DEFAULT/default_l3_gw_service_uuid').with_value(p[:default_l3_gw_service_uuid])
should contain_neutron_plugin_nvp('DEFAULT/default_tz_uuid').with_value(p[:default_tz_uuid])
should contain_neutron_plugin_nvp('nvp/metadata_mode').with_value(p[:metadata_mode])
should contain_neutron_plugin_nvp('DEFAULT/nvp_controllers').with_value(p[:nvp_controllers].join(','))
should contain_neutron_plugin_nvp('DEFAULT/nvp_user').with_value(p[:nvp_user])
should contain_neutron_plugin_nvp('DEFAULT/nvp_password').with_value(p[:nvp_password])
should contain_neutron_plugin_nvp('DEFAULT/nvp_password').with_secret( true )
should_not contain_neutron_plugin_nvp('DEFAULT/default_l3_gw_service_uuid').with_value(p[:default_l3_gw_service_uuid])
end
context 'configure nvp with optional params' do
@ -82,7 +80,7 @@ describe 'neutron::plugins::nvp' do
end
it 'should configure nvp.ini' do
is_expected.to contain_neutron_plugin_nvp('DEFAULT/default_l3_gw_service_uuid').with_value(params[:default_l3_gw_service_uuid])
should contain_neutron_plugin_nvp('DEFAULT/default_l3_gw_service_uuid').with_value(params[:default_l3_gw_service_uuid])
end
end
@ -92,41 +90,32 @@ describe 'neutron::plugins::nvp' do
core_plugin => 'foo' }"
end
it_raises 'a Puppet::Error', /nvp plugin should be the core_plugin in neutron.conf/
it { should raise_error(Puppet::Error, /nvp plugin should be the core_plugin in neutron.conf/) }
end
end
begin
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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
let :platform_params do
{ :nvp_server_package => 'neutron-plugin-nicira' }
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:nvp_server_package => 'neutron-plugin-nicira'
}
when 'RedHat'
{
:nvp_server_package => 'openstack-neutron-nicira'
}
end
end
it_configures 'neutron plugin nvp'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
let :platform_params do
{ :nvp_server_package => 'openstack-neutron-nicira' }
end
it_configures 'neutron plugin nvp'
it_behaves_like 'neutron plugin nvp'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::opencontrail' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -11,7 +10,8 @@ describe 'neutron::plugins::opencontrail' do
end
let :default_params do
{ :api_server_ip => '10.0.0.1',
{
:api_server_ip => '10.0.0.1',
:api_server_port => '8082',
:multi_tenancy => 'true',
:contrail_extensions => ['ipam:ipam','policy:policy','route-table'],
@ -24,14 +24,7 @@ describe 'neutron::plugins::opencontrail' do
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron opencontrail plugin' do
shared_examples 'neutron opencontrail plugin' do
let :params do
{}
end
@ -41,71 +34,69 @@ describe 'neutron::plugins::opencontrail' do
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_plugin_opencontrail').with({
should contain_resources('neutron_plugin_opencontrail').with({
:purge => false
})
end
it 'should perform default configuration of' do
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/api_server_ip').with_value(params[:api_server_ip])
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/api_server_port').with_value(params[:api_server_port])
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/multi_tenancy').with_value(params[:multi_tenancy])
is_expected.to contain_neutron_plugin_opencontrail('APISERVER/contrail_extensions').with_value(params[:contrail_extensions].join(','))
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/auth_url').with_value(params[:keystone_auth_url])
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_user').with_value(params[:keystone_admin_user])
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_tenant_name').with_value(params[:keystone_admin_tenant_name])
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_password').with_value(params[:keystone_admin_password]).with_secret(true)
is_expected.to contain_neutron_plugin_opencontrail('KEYSTONE/admin_token').with_value(params[:keystone_admin_token])
should contain_neutron_plugin_opencontrail('APISERVER/api_server_ip').with_value(params[:api_server_ip])
should contain_neutron_plugin_opencontrail('APISERVER/api_server_port').with_value(params[:api_server_port])
should contain_neutron_plugin_opencontrail('APISERVER/multi_tenancy').with_value(params[:multi_tenancy])
should contain_neutron_plugin_opencontrail('APISERVER/contrail_extensions').with_value(params[:contrail_extensions].join(','))
should contain_neutron_plugin_opencontrail('KEYSTONE/auth_url').with_value(params[:keystone_auth_url])
should contain_neutron_plugin_opencontrail('KEYSTONE/admin_user').with_value(params[:keystone_admin_user])
should contain_neutron_plugin_opencontrail('KEYSTONE/admin_tenant_name').with_value(params[:keystone_admin_tenant_name])
should contain_neutron_plugin_opencontrail('KEYSTONE/admin_password').with_value(params[:keystone_admin_password]).with_secret(true)
should contain_neutron_plugin_opencontrail('KEYSTONE/admin_token').with_value(params[:keystone_admin_token])
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
shared_examples 'neutron::plugins::opencontrail on Debian' do
let :params do
{ :contrail_extensions => ['ipam:ipam','policy:policy','route-table'] }
{
:contrail_extensions => ['ipam:ipam','policy:policy','route-table']
}
end
it 'configures /etc/default/neutron-server' do
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
should 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/opencontrail/ContrailPlugin.ini',
:tag => 'neutron-file-line',
)
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
it_configures 'neutron opencontrail plugin'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
shared_examples 'neutron::plugins::opencontrail on RedHat' do
let :params do
{ :contrail_extensions => ['ipam:ipam','policy:policy','route-table'] }
{
:contrail_extensions => ['ipam:ipam','policy:policy','route-table']
}
end
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/opencontrail/ContrailPlugin.ini',
:require => 'Package[neutron-plugin-contrail]'
)
end
it_configures 'neutron opencontrail plugin'
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 'neutron opencontrail plugin'
it_behaves_like "neutron::plugins::opencontrail on #{facts[:osfamily]}"
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::ovs::opendaylight' do
let :default_params do
{
:odl_check_url => 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1',
@ -29,15 +28,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin opendaylight ovs' do
shared_examples 'neutron plugin opendaylight ovs' do
before do
params.merge!(default_params)
end
@ -46,30 +37,32 @@ describe 'neutron::plugins::ovs::opendaylight' do
before do
params.merge!({ :provider_mappings => ['default:br-ex'] })
end
it_configures 'with provider mappings'
it_behaves_like 'with provider mappings'
end
context 'with DPDK enabled' do
before do
params.merge!({ :enable_dpdk => true })
end
it_configures 'with DPDK enabled'
it_behaves_like 'with DPDK enabled'
end
context 'with hw_offload and DPDK enabled' do
before do
params.merge!({ :enable_hw_offload => true, :enable_dpdk => true})
end
it_raises 'a Puppet::Error',/Enabling hardware offload and DPDK is not allowed/
it { should raise_error(Puppet::Error, /Enabling hardware offload and DPDK is not allowed/) }
end
it_configures 'with default parameters'
it_behaves_like 'with default parameters'
context 'with TLS and no key or certificates' do
before do
params.merge!({ :enable_tls => true })
end
it_raises 'a Puppet::Error',/When enabling TLS, tls_key_file and tls_cert_file must be provided/
it { should raise_error(Puppet::Error, /When enabling TLS, tls_key_file and tls_cert_file must be provided/) }
end
context 'with TLS and no CA cert' do
@ -81,8 +74,8 @@ describe 'neutron::plugins::ovs::opendaylight' do
:tls_key_file => 'dummy.pem',
:tls_cert_file => 'dummy.crt'})
end
it_configures 'with TLS enabled'
it {is_expected.to contain_vs_ssl('system').with(
it_behaves_like 'with TLS enabled'
it {should contain_vs_ssl('system').with(
'ensure' => 'present',
'key_file' => 'dummy.pem',
'cert_file' => 'dummy.crt',
@ -90,6 +83,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
'before' => 'Exec[Set OVS Manager to OpenDaylight]'
)}
end
context 'with TLS and CA cert' do
before do
File.stubs(:file?).returns(true)
@ -100,8 +94,8 @@ describe 'neutron::plugins::ovs::opendaylight' do
:tls_cert_file => 'dummy.crt',
:tls_ca_cert_file => 'ca.crt'})
end
it_configures 'with TLS enabled'
it {is_expected.to contain_vs_ssl('system').with(
it_behaves_like 'with TLS enabled'
it {should contain_vs_ssl('system').with(
'ensure' => 'present',
'key_file' => 'dummy.pem',
'cert_file' => 'dummy.crt',
@ -109,6 +103,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
'before' => 'Exec[Set OVS Manager to OpenDaylight]'
)}
end
context 'with TLS and multiple ODLs' do
before do
File.stubs(:file?).returns(true)
@ -119,8 +114,9 @@ describe 'neutron::plugins::ovs::opendaylight' do
:tls_cert_file => 'dummy.crt',
:odl_ovsdb_iface => 'ssl:127.0.0.1:6640 ssl:172.0.0.1:6640'})
end
it_configures 'with TLS and ODL HA'
it {is_expected.to contain_vs_ssl('system').with(
it_behaves_like 'with TLS and ODL HA'
it {should contain_vs_ssl('system').with(
'ensure' => 'present',
'key_file' => 'dummy.pem',
'cert_file' => 'dummy.crt',
@ -128,6 +124,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
'before' => 'Exec[Set OVS Manager to OpenDaylight]'
)}
end
context 'with IPv6 enabled' do
before do
params.merge!({
@ -135,114 +132,106 @@ describe 'neutron::plugins::ovs::opendaylight' do
:odl_ovsdb_iface => 'tcp:[::1]:6640',
})
end
it_configures 'with IPv6 enabled'
it_behaves_like 'with IPv6 enabled'
end
end
shared_examples_for 'with default parameters' do
shared_examples 'with default parameters' do
it 'configures OVS for ODL' do
is_expected.to contain_exec('Wait for NetVirt OVSDB to come up')
is_expected.to contain_exec('Set OVS Manager to OpenDaylight')
is_expected.to contain_vs_config('other_config:local_ip')
is_expected.not_to contain_vs_config('other_config:provider_mappings')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_hostid')
is_expected.to contain_vs_config('external_ids:hostname')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
should contain_exec('Wait for NetVirt OVSDB to come up')
should contain_exec('Set OVS Manager to OpenDaylight')
should contain_vs_config('other_config:local_ip')
should_not contain_vs_config('other_config:provider_mappings')
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
should contain_vs_config('external_ids:hostname')
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
end
end
shared_examples_for 'with provider mappings' do
shared_examples 'with provider mappings' do
it 'configures OVS for ODL' do
is_expected.to contain_exec('Wait for NetVirt OVSDB to come up')
is_expected.to contain_exec('Set OVS Manager to OpenDaylight')
is_expected.to contain_vs_config('other_config:local_ip')
is_expected.to contain_vs_config('other_config:provider_mappings')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_hostid')
is_expected.to contain_vs_config('external_ids:hostname')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2').with(
should contain_exec('Wait for NetVirt OVSDB to come up')
should contain_exec('Set OVS Manager to OpenDaylight')
should contain_vs_config('other_config:local_ip')
should contain_vs_config('other_config:provider_mappings')
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
should contain_vs_config('external_ids:hostname')
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2').with(
:value => /bridge_mappings\": {\"default\":\"br-ex\"}/
)
end
end
shared_examples_for 'with DPDK enabled' do
shared_examples 'with DPDK enabled' do
it 'configures OVS for ODL' do
is_expected.to contain_exec('Wait for NetVirt OVSDB to come up')
is_expected.to contain_exec('Set OVS Manager to OpenDaylight')
is_expected.to contain_vs_config('other_config:local_ip')
is_expected.not_to contain_vs_config('other_config:provider_mappings')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_hostid')
is_expected.to contain_vs_config('external_ids:hostname')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2').with(
should contain_exec('Wait for NetVirt OVSDB to come up')
should contain_exec('Set OVS Manager to OpenDaylight')
should contain_vs_config('other_config:local_ip')
should_not contain_vs_config('other_config:provider_mappings')
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
should contain_vs_config('external_ids:hostname')
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2').with(
:value => /vhostuser/,
)
end
end
shared_examples_for 'with TLS enabled' do
shared_examples 'with TLS enabled' do
before do
params.merge!({ :odl_ovsdb_iface => 'ssl:127.0.0.1:6640' })
end
it 'configures OVS for ODL' do
is_expected.to contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
is_expected.to contain_exec('Set OVS Manager to OpenDaylight').with(
should contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
should contain_exec('Set OVS Manager to OpenDaylight').with(
:command => "ovs-vsctl set-manager pssl:6639:127.0.0.1 ssl:127.0.0.1:6640"
)
is_expected.to contain_vs_config('other_config:local_ip')
is_expected.not_to contain_vs_config('other_config:provider_mappings')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_hostid')
is_expected.to contain_vs_config('external_ids:hostname')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
should contain_vs_config('other_config:local_ip')
should_not contain_vs_config('other_config:provider_mappings')
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
should contain_vs_config('external_ids:hostname')
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
end
end
shared_examples_for 'with TLS and ODL HA' do
shared_examples 'with TLS and ODL HA' do
it 'configures OVS for ODL' do
is_expected.to contain_exec('Add trusted cert: dummy.crt to https://172.0.0.1:8080')
is_expected.to contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
is_expected.to contain_exec('Set OVS Manager to OpenDaylight').with(
should contain_exec('Add trusted cert: dummy.crt to https://172.0.0.1:8080')
should contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
should contain_exec('Set OVS Manager to OpenDaylight').with(
:command => "ovs-vsctl set-manager pssl:6639:127.0.0.1 ssl:127.0.0.1:6640 ssl:172.0.0.1:6640"
)
is_expected.to contain_vs_config('other_config:local_ip')
is_expected.not_to contain_vs_config('other_config:provider_mappings')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_hostid')
is_expected.to contain_vs_config('external_ids:hostname')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
should contain_vs_config('other_config:local_ip')
should_not contain_vs_config('other_config:provider_mappings')
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
should contain_vs_config('external_ids:hostname')
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
end
end
shared_examples_for 'with IPv6 enabled' do
shared_examples 'with IPv6 enabled' do
it 'configures OVS for ODL' do
is_expected.to contain_exec('Wait for NetVirt OVSDB to come up')
is_expected.to contain_exec('Set OVS Manager to OpenDaylight').with(
should contain_exec('Wait for NetVirt OVSDB to come up')
should contain_exec('Set OVS Manager to OpenDaylight').with(
:command => "ovs-vsctl set-manager ptcp:6639:[::1] tcp:[::1]:6640"
)
is_expected.to contain_vs_config('other_config:local_ip')
is_expected.not_to contain_vs_config('other_config:provider_mappings')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_hostid')
is_expected.to contain_vs_config('external_ids:hostname')
is_expected.to contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
should contain_vs_config('other_config:local_ip')
should_not contain_vs_config('other_config:provider_mappings')
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
should contain_vs_config('external_ids:hostname')
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
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 'neutron plugin opendaylight ovs'
end
it_configures 'neutron plugin opendaylight ovs'
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian'
}))
end
it_configures 'neutron plugin opendaylight ovs'
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::plugins::plumgrid' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -29,14 +28,7 @@ describe 'neutron::plugins::plumgrid' do
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron plumgrid plugin' do
shared_examples 'neutron plumgrid plugin' do
let :params do
{}
end
@ -46,99 +38,92 @@ describe 'neutron::plugins::plumgrid' do
end
it 'installs plumgrid plugin package' do
is_expected.to contain_package('neutron-plugin-plumgrid').with(
should contain_package('neutron-plugin-plumgrid').with(
:ensure => 'present'
)
end
it 'installs plumgrid plumlib package' do
is_expected.to contain_package('neutron-plumlib-plumgrid').with(
should contain_package('neutron-plumlib-plumgrid').with(
:ensure => 'present'
)
end
it 'passes purge to resource plugin_plumgrid' do
is_expected.to contain_resources('neutron_plugin_plumgrid').with({
should contain_resources('neutron_plugin_plumgrid').with({
:purge => false
})
end
it 'passes purge to resource plumlib_plumgrid' do
is_expected.to contain_resources('neutron_plumlib_plumgrid').with({
should contain_resources('neutron_plumlib_plumgrid').with({
:purge => false
})
end
it 'should perform default configuration of plumgrid plugin' do
is_expected.to contain_neutron_plugin_plumgrid('PLUMgridDirector/director_server').with_value(params[:director_server])
is_expected.to contain_neutron_plugin_plumgrid('PLUMgridDirector/director_server_port').with_value(params[:director_server_port])
is_expected.to contain_neutron_plugin_plumgrid('PLUMgridDirector/username').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_plumgrid('PLUMgridDirector/password').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_neutron_plugin_plumgrid('PLUMgridDirector/servertimeout').with_value(params[:servertimeout])
is_expected.to contain_neutron_plugin_plumgrid('database/connection').with_value(params[:connection])
is_expected.to contain_neutron_plugin_plumgrid('l2gateway/vendor').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_plumgrid('l2gateway/sw_username').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_plugin_plumgrid('l2gateway/sw_password').with_value('<SERVICE DEFAULT>').with_secret(true)
should contain_neutron_plugin_plumgrid('PLUMgridDirector/director_server').with_value(params[:director_server])
should contain_neutron_plugin_plumgrid('PLUMgridDirector/director_server_port').with_value(params[:director_server_port])
should contain_neutron_plugin_plumgrid('PLUMgridDirector/username').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_plumgrid('PLUMgridDirector/password').with_value('<SERVICE DEFAULT>').with_secret(true)
should contain_neutron_plugin_plumgrid('PLUMgridDirector/servertimeout').with_value(params[:servertimeout])
should contain_neutron_plugin_plumgrid('database/connection').with_value(params[:connection])
should contain_neutron_plugin_plumgrid('l2gateway/vendor').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_plumgrid('l2gateway/sw_username').with_value('<SERVICE DEFAULT>')
should contain_neutron_plugin_plumgrid('l2gateway/sw_password').with_value('<SERVICE DEFAULT>').with_secret(true)
end
it 'should perform default configuration of plumgrid plumlib' do
auth_uri = params[:auth_protocol] + "://" + params[:controller_priv_host] + ":" + "5000/" + params[:identity_version];
is_expected.to contain_neutron_plumlib_plumgrid('keystone_authtoken/auth_uri').with_value(auth_uri)
is_expected.to contain_neutron_plumlib_plumgrid('keystone_authtoken/identity_version').with_value(params[:identity_version])
is_expected.to contain_neutron_plumlib_plumgrid('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name])
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/enable_pg_metadata').with_value('True')
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/metadata_mode').with_value('local')
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_ip').with_value(params[:nova_metadata_ip])
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_host').with_value(params[:nova_metadata_host])
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_port').with_value(params[:nova_metadata_port])
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_subnet').with_value(params[:nova_metadata_subnet])
is_expected.to contain_neutron_plumlib_plumgrid('PLUMgridMetadata/metadata_proxy_shared_secret').with_value('<SERVICE DEFAULT>').with_secret(true)
is_expected.to contain_neutron_plumlib_plumgrid('ConnectorType/connector_type').with_value('distributed')
should contain_neutron_plumlib_plumgrid('keystone_authtoken/auth_uri').with_value(auth_uri)
should contain_neutron_plumlib_plumgrid('keystone_authtoken/identity_version').with_value(params[:identity_version])
should contain_neutron_plumlib_plumgrid('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name])
should contain_neutron_plumlib_plumgrid('PLUMgridMetadata/enable_pg_metadata').with_value('True')
should contain_neutron_plumlib_plumgrid('PLUMgridMetadata/metadata_mode').with_value('local')
should contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_ip').with_value(params[:nova_metadata_ip])
should contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_host').with_value(params[:nova_metadata_host])
should contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_port').with_value(params[:nova_metadata_port])
should contain_neutron_plumlib_plumgrid('PLUMgridMetadata/nova_metadata_subnet').with_value(params[:nova_metadata_subnet])
should contain_neutron_plumlib_plumgrid('PLUMgridMetadata/metadata_proxy_shared_secret').with_value('<SERVICE DEFAULT>').with_secret(true)
should contain_neutron_plumlib_plumgrid('ConnectorType/connector_type').with_value('distributed')
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
shared_examples 'neutron::plugins::plumgrid on Debian' do
it 'configures /etc/default/neutron-server' do
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').with(
should 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/plumgrid/plumgrid.ini',
:tag => 'neutron-file-line',
)
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_requires('Anchor[neutron::config::begin]')
should contain_file_line('/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG').that_notifies('Anchor[neutron::config::end]')
end
it_configures 'neutron plumgrid plugin'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
shared_examples 'neutron::plugins::plumgrid on RedHat' do
it 'should create plugin symbolic link' do
is_expected.to contain_file('/etc/neutron/plugin.ini').with(
should contain_file('/etc/neutron/plugin.ini').with(
:ensure => 'link',
:target => '/etc/neutron/plugins/plumgrid/plumgrid.ini',
:tag => 'neutron-config-file')
is_expected.to contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
is_expected.to contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
should contain_file('/etc/neutron/plugin.ini').that_requires('Anchor[neutron::config::begin]')
should contain_file('/etc/neutron/plugin.ini').that_notifies('Anchor[neutron::config::end]')
end
it_configures 'neutron plumgrid plugin'
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 'neutron plumgrid plugin'
it_behaves_like "neutron::plugins::plumgrid on #{facts[:osfamily]}"
end
end
end

View File

@ -1,8 +1,7 @@
require 'spec_helper'
describe 'neutron::policy' do
shared_examples_for 'neutron policies' do
shared_examples 'neutron policies' do
let :params do
{
:policy_path => '/etc/neutron/policy.json',
@ -16,13 +15,13 @@ describe 'neutron::policy' do
end
it 'set up the policies' do
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
should contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar',
:file_user => 'root',
:file_group => 'neutron',
})
is_expected.to contain_oslo__policy('neutron_config').with(
should contain_oslo__policy('neutron_config').with(
:policy_file => '/etc/neutron/policy.json',
)
end
@ -36,7 +35,7 @@ describe 'neutron::policy' do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'neutron policies'
it_behaves_like 'neutron policies'
end
end
end

View File

@ -1,62 +1,71 @@
require 'spec_helper'
describe 'neutron::quota' do
let :params do
{}
end
let :default_params do
{ :quota_firewall_rule => -1,
:quota_network_gateway => 5,
:quota_packet_filter => 100 }
end
let :facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
{
:quota_firewall_rule => -1,
:quota_network_gateway => 5,
:quota_packet_filter => 100
}
end
shared_examples_for 'neutron quota' do
shared_examples 'neutron::quota test' do
let :params_hash do
default_params.merge(params)
end
it 'configures quota in neutron.conf' do
params_hash.each_pair do |config,value|
is_expected.to contain_neutron_config("quotas/#{config}").with_value( value )
should contain_neutron_config("quotas/#{config}").with_value( value )
end
end
end
context 'with default parameters' do
it_configures 'neutron quota'
end
context 'with provided parameters' do
before do
params.merge!({
:quota_network => 20,
:quota_subnet => 20,
:quota_port => 100,
:quota_router => 20,
:quota_floatingip => 100,
:quota_security_group => 20,
:quota_security_group_rule => 200,
:quota_firewall => 1,
:quota_firewall_policy => 1,
:quota_firewall_rule => -1,
:quota_healthmonitor => -1,
:quota_member => -1,
:quota_network_gateway => 5,
:quota_packet_filter => 100,
:quota_loadbalancer => 10,
:quota_pool => 10,
:quota_vip => 10
})
shared_examples 'neutron::quota' do
context 'with default' do
it_behaves_like 'neutron::quota test'
end
it_configures 'neutron quota'
context 'with provided parameters' do
before do
params.merge!({
:quota_network => 20,
:quota_subnet => 20,
:quota_port => 100,
:quota_router => 20,
:quota_floatingip => 100,
:quota_security_group => 20,
:quota_security_group_rule => 200,
:quota_firewall => 1,
:quota_firewall_policy => 1,
:quota_firewall_rule => -1,
:quota_healthmonitor => -1,
:quota_member => -1,
:quota_network_gateway => 5,
:quota_packet_filter => 100,
:quota_loadbalancer => 10,
:quota_pool => 10,
:quota_vip => 10
})
end
it_behaves_like 'neutron::quota test'
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 'neutron::quota'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::rootwrap' do
let :pre_condition do
"class { 'neutron::agents::ml2::ovs': }"
end
@ -13,12 +12,12 @@ describe 'neutron::rootwrap' do
}
end
shared_examples_for 'neutron rootwrap' do
shared_examples 'neutron rootwrap' do
it 'configures rootwrap.conf' do
is_expected.to contain_neutron_rootwrap_config('xenapi/xenapi_connection_url').with_value(params[:xenapi_connection_url]);
is_expected.to contain_neutron_rootwrap_config('xenapi/xenapi_connection_username').with_value(params[:xenapi_connection_username]);
is_expected.to contain_neutron_rootwrap_config('xenapi/xenapi_connection_password').with_value(params[:xenapi_connection_password]);
should contain_neutron_rootwrap_config('xenapi/xenapi_connection_url').with_value(params[:xenapi_connection_url]);
should contain_neutron_rootwrap_config('xenapi/xenapi_connection_username').with_value(params[:xenapi_connection_username]);
should contain_neutron_rootwrap_config('xenapi/xenapi_connection_password').with_value(params[:xenapi_connection_password]);
end
end
@ -33,7 +32,7 @@ describe 'neutron::rootwrap' do
}))
end
it_configures 'neutron rootwrap'
it_behaves_like 'neutron rootwrap'
end
end
end

View File

@ -16,125 +16,98 @@
require 'spec_helper'
describe 'neutron::server::notifications' do
let :params do
{
:notify_nova_on_port_status_changes => true,
:notify_nova_on_port_data_changes => true,
:auth_type => 'password',
:username => 'nova',
:password => 'secrete',
:tenant_name => 'services',
:project_domain_id => 'default',
:project_domain_name => 'Default',
:project_name => 'services',
:user_domain_id => 'default',
:user_domain_name => 'Default',
:auth_url => 'http://127.0.0.1:5000',
}
end
let :params do
{
:notify_nova_on_port_status_changes => true,
:notify_nova_on_port_data_changes => true,
:auth_type => 'password',
:username => 'nova',
:password => 'secrete',
:tenant_name => 'services',
:project_domain_id => 'default',
:project_domain_name => 'Default',
:project_name => 'services',
:user_domain_id => 'default',
:user_domain_name => 'Default',
:auth_url => 'http://127.0.0.1:5000',
}
shared_examples 'neutron server notifications' do
it 'configure neutron.conf' do
should contain_neutron_config('DEFAULT/notify_nova_on_port_status_changes').with_value(true)
should contain_neutron_config('DEFAULT/notify_nova_on_port_data_changes').with_value(true)
should contain_neutron_config('DEFAULT/send_events_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('nova/auth_type').with_value('password')
should contain_neutron_config('nova/auth_url').with_value('http://127.0.0.1:5000')
should contain_neutron_config('nova/username').with_value('nova')
should contain_neutron_config('nova/password').with_value('secrete')
should contain_neutron_config('nova/password').with_secret( true )
should contain_neutron_config('nova/tenant_name').with_value('services')
should contain_neutron_config('nova/region_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('nova/project_domain_id').with_value('default')
should contain_neutron_config('nova/project_domain_name').with_value('Default')
should contain_neutron_config('nova/user_domain_id').with_value('default')
should contain_neutron_config('nova/user_domain_name').with_value('Default')
should contain_neutron_config('nova/endpoint_type').with_value('<SERVICE DEFAULT>')
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
context 'when overriding parameters' do
before :each do
params.merge!(
:notify_nova_on_port_status_changes => false,
:notify_nova_on_port_data_changes => false,
:send_events_interval => '10',
:auth_url => 'http://keystone:5000/v2.0',
:auth_type => 'v2password',
:username => 'joe',
:region_name => 'MyRegion',
:tenant_id => 'UUID2',
:project_domain_id => 'default_1',
:project_domain_name => 'Default_2',
:user_domain_id => 'default_3',
:user_domain_name => 'Default_4',
:endpoint_type => 'internal'
)
end
it 'should configure neutron server with overrided parameters' do
should contain_neutron_config('DEFAULT/notify_nova_on_port_status_changes').with_value(false)
should contain_neutron_config('DEFAULT/notify_nova_on_port_data_changes').with_value(false)
should contain_neutron_config('DEFAULT/send_events_interval').with_value('10')
should contain_neutron_config('nova/auth_url').with_value('http://keystone:5000/v2.0')
should contain_neutron_config('nova/auth_type').with_value('v2password')
should contain_neutron_config('nova/username').with_value('joe')
should contain_neutron_config('nova/password').with_value('secrete')
should contain_neutron_config('nova/password').with_secret( true )
should contain_neutron_config('nova/region_name').with_value('MyRegion')
should contain_neutron_config('nova/tenant_id').with_value('UUID2')
should contain_neutron_config('nova/project_domain_id').with_value('default_1')
should contain_neutron_config('nova/project_domain_name').with_value('Default_2')
should contain_neutron_config('nova/user_domain_id').with_value('default_3')
should contain_neutron_config('nova/user_domain_name').with_value('Default_4')
should contain_neutron_config('nova/endpoint_type').with_value('internal')
end
end
shared_examples_for 'neutron server notifications' do
it 'configure neutron.conf' do
is_expected.to contain_neutron_config('DEFAULT/notify_nova_on_port_status_changes').with_value(true)
is_expected.to contain_neutron_config('DEFAULT/notify_nova_on_port_data_changes').with_value(true)
is_expected.to contain_neutron_config('DEFAULT/send_events_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('nova/auth_type').with_value('password')
is_expected.to contain_neutron_config('nova/auth_url').with_value('http://127.0.0.1:5000')
is_expected.to contain_neutron_config('nova/username').with_value('nova')
is_expected.to contain_neutron_config('nova/password').with_value('secrete')
is_expected.to contain_neutron_config('nova/password').with_secret( true )
is_expected.to contain_neutron_config('nova/tenant_name').with_value('services')
is_expected.to contain_neutron_config('nova/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('nova/project_domain_id').with_value('default')
is_expected.to contain_neutron_config('nova/project_domain_name').with_value('Default')
is_expected.to contain_neutron_config('nova/user_domain_id').with_value('default')
is_expected.to contain_neutron_config('nova/user_domain_name').with_value('Default')
is_expected.to contain_neutron_config('nova/endpoint_type').with_value('<SERVICE DEFAULT>')
end
context 'when overriding parameters' do
before :each do
params.merge!(
:notify_nova_on_port_status_changes => false,
:notify_nova_on_port_data_changes => false,
:send_events_interval => '10',
:auth_url =>
'http://keystone:5000/v2.0',
:auth_type => 'v2password',
:username => 'joe',
:region_name => 'MyRegion',
:tenant_id => 'UUID2',
:project_domain_id => 'default_1',
:project_domain_name => 'Default_2',
:user_domain_id => 'default_3',
:user_domain_name => 'Default_4',
:endpoint_type => 'internal'
)
end
it 'should configure neutron server with overrided parameters' do
is_expected.to contain_neutron_config('DEFAULT/notify_nova_on_port_status_changes').with_value(false)
is_expected.to contain_neutron_config('DEFAULT/notify_nova_on_port_data_changes').with_value(false)
is_expected.to contain_neutron_config('DEFAULT/send_events_interval').with_value('10')
is_expected.to contain_neutron_config('nova/auth_url').with_value('http://keystone:5000/v2.0')
is_expected.to contain_neutron_config('nova/auth_type').with_value('v2password')
is_expected.to contain_neutron_config('nova/username').with_value('joe')
is_expected.to contain_neutron_config('nova/password').with_value('secrete')
is_expected.to contain_neutron_config('nova/password').with_secret( true )
is_expected.to contain_neutron_config('nova/region_name').with_value('MyRegion')
is_expected.to contain_neutron_config('nova/tenant_id').with_value('UUID2')
is_expected.to contain_neutron_config('nova/project_domain_id').with_value('default_1')
is_expected.to contain_neutron_config('nova/project_domain_name').with_value('Default_2')
is_expected.to contain_neutron_config('nova/user_domain_id').with_value('default_3')
is_expected.to contain_neutron_config('nova/user_domain_name').with_value('Default_4')
is_expected.to contain_neutron_config('nova/endpoint_type').with_value('internal')
end
end
context 'when no tenant_id and tenant_name specified' do
before :each do
params.merge!({ :tenant_name => false })
end
it_raises 'a Puppet::Error', /You must provide either tenant_name or tenant_id./
end
context 'when no tenant_id and tenant_name specified' do
before :each do
params.merge!({ :tenant_name => false })
end
it { should raise_error(Puppet::Error, /You must provide either tenant_name or tenant_id./) }
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian'
}))
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
let :platform_params do
{}
end
it_configures 'neutron server notifications'
it_behaves_like 'neutron server notifications'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
end
let :platform_params do
{}
end
it_configures 'neutron server notifications'
end
end
end

View File

@ -16,99 +16,75 @@
require 'spec_helper'
describe 'neutron::server::placement' do
let :params do
{
:auth_type => 'password',
:username => 'nova',
:password => 'secrete',
:project_domain_id => 'default',
:project_domain_name => 'Default',
:project_name => 'services',
:user_domain_id => 'default',
:user_domain_name => 'Default',
:auth_url => 'http://127.0.0.1:5000',
}
end
let :params do
{
:auth_type => 'password',
:username => 'nova',
:password => 'secrete',
:project_domain_id => 'default',
:project_domain_name => 'Default',
:project_name => 'services',
:user_domain_id => 'default',
:user_domain_name => 'Default',
:auth_url => 'http://127.0.0.1:5000',
}
shared_examples 'neutron server placement' do
it 'configure neutron.conf' do
should contain_neutron_config('placement/auth_type').with_value('password')
should contain_neutron_config('placement/auth_url').with_value('http://127.0.0.1:5000')
should contain_neutron_config('placement/username').with_value('nova')
should contain_neutron_config('placement/password').with_value('secrete')
should contain_neutron_config('placement/password').with_secret( true )
should contain_neutron_config('placement/region_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('placement/project_domain_id').with_value('default')
should contain_neutron_config('placement/project_domain_name').with_value('Default')
should contain_neutron_config('placement/user_domain_id').with_value('default')
should contain_neutron_config('placement/user_domain_name').with_value('Default')
should contain_neutron_config('placement/endpoint_type').with_value('<SERVICE DEFAULT>')
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
context 'when overriding parameters' do
before :each do
params.merge!(
:auth_url => 'http://keystone:5000/v2.0',
:auth_type => 'v2password',
:username => 'joe',
:region_name => 'MyRegion',
:project_domain_id => 'default_1',
:project_domain_name => 'Default_2',
:user_domain_id => 'default_3',
:user_domain_name => 'Default_4',
:endpoint_type => 'internal'
)
end
it 'should configure neutron server with overrided parameters' do
should contain_neutron_config('placement/auth_url').with_value('http://keystone:5000/v2.0')
should contain_neutron_config('placement/auth_type').with_value('v2password')
should contain_neutron_config('placement/username').with_value('joe')
should contain_neutron_config('placement/password').with_value('secrete')
should contain_neutron_config('placement/password').with_secret( true )
should contain_neutron_config('placement/region_name').with_value('MyRegion')
should contain_neutron_config('placement/project_domain_id').with_value('default_1')
should contain_neutron_config('placement/project_domain_name').with_value('Default_2')
should contain_neutron_config('placement/user_domain_id').with_value('default_3')
should contain_neutron_config('placement/user_domain_name').with_value('Default_4')
should contain_neutron_config('placement/endpoint_type').with_value('internal')
end
end
end
shared_examples_for 'neutron server placement' do
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 'configure neutron.conf' do
is_expected.to contain_neutron_config('placement/auth_type').with_value('password')
is_expected.to contain_neutron_config('placement/auth_url').with_value('http://127.0.0.1:5000')
is_expected.to contain_neutron_config('placement/username').with_value('nova')
is_expected.to contain_neutron_config('placement/password').with_value('secrete')
is_expected.to contain_neutron_config('placement/password').with_secret( true )
is_expected.to contain_neutron_config('placement/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('placement/project_domain_id').with_value('default')
is_expected.to contain_neutron_config('placement/project_domain_name').with_value('Default')
is_expected.to contain_neutron_config('placement/user_domain_id').with_value('default')
is_expected.to contain_neutron_config('placement/user_domain_name').with_value('Default')
is_expected.to contain_neutron_config('placement/endpoint_type').with_value('<SERVICE DEFAULT>')
end
context 'when overriding parameters' do
before :each do
params.merge!(
:auth_url => 'http://keystone:5000/v2.0',
:auth_type => 'v2password',
:username => 'joe',
:region_name => 'MyRegion',
:project_domain_id => 'default_1',
:project_domain_name => 'Default_2',
:user_domain_id => 'default_3',
:user_domain_name => 'Default_4',
:endpoint_type => 'internal'
)
end
it 'should configure neutron server with overrided parameters' do
is_expected.to contain_neutron_config('placement/auth_url').with_value('http://keystone:5000/v2.0')
is_expected.to contain_neutron_config('placement/auth_type').with_value('v2password')
is_expected.to contain_neutron_config('placement/username').with_value('joe')
is_expected.to contain_neutron_config('placement/password').with_value('secrete')
is_expected.to contain_neutron_config('placement/password').with_secret( true )
is_expected.to contain_neutron_config('placement/region_name').with_value('MyRegion')
is_expected.to contain_neutron_config('placement/project_domain_id').with_value('default_1')
is_expected.to contain_neutron_config('placement/project_domain_name').with_value('Default_2')
is_expected.to contain_neutron_config('placement/user_domain_id').with_value('default_3')
is_expected.to contain_neutron_config('placement/user_domain_name').with_value('Default_4')
is_expected.to contain_neutron_config('placement/endpoint_type').with_value('internal')
end
end
it_behaves_like 'neutron server placement'
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian'
}))
end
let :platform_params do
{}
end
it_configures 'neutron server placement'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
end
let :platform_params do
{}
end
it_configures 'neutron server placement'
end
end
end

View File

@ -1,7 +1,6 @@
require 'spec_helper'
describe 'neutron::server' do
let :pre_condition do
"class { 'neutron': }
class { '::neutron::keystone::authtoken':
@ -14,81 +13,77 @@ describe 'neutron::server' do
end
let :default_params do
{ :package_ensure => 'present',
:enabled => true,
:auth_strategy => 'keystone',
:database_connection => 'sqlite:////var/lib/neutron/ovs.sqlite',
:database_max_retries => 10,
:database_idle_timeout => 3600,
:database_retry_interval => 10,
:database_min_pool_size => 1,
:database_max_pool_size => 10,
:database_max_overflow => 20,
:sync_db => false,
:router_scheduler_driver => 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
:l3_ha => false,
:max_l3_agents_per_router => 3,
{
:package_ensure => 'present',
:enabled => true,
:auth_strategy => 'keystone',
:database_connection => 'sqlite:////var/lib/neutron/ovs.sqlite',
:database_max_retries => 10,
:database_idle_timeout => 3600,
:database_retry_interval => 10,
:database_min_pool_size => 1,
:database_max_pool_size => 10,
:database_max_overflow => 20,
:sync_db => false,
:router_scheduler_driver => 'neutron.scheduler.l3_agent_scheduler.ChanceScheduler',
:l3_ha => false,
:max_l3_agents_per_router => 3,
}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'a neutron server' do
shared_examples 'a neutron server' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_class('neutron::db') }
it { is_expected.to contain_class('neutron::params') }
it { is_expected.to contain_class('neutron::policy') }
it { should contain_class('neutron::db') }
it { should contain_class('neutron::params') }
it { should contain_class('neutron::policy') }
it 'installs neutron server package' do
if platform_params.has_key?(:server_package)
is_expected.to contain_package('neutron-server').with(
should contain_package('neutron-server').with(
:name => platform_params[:server_package],
:ensure => p[:package_ensure],
:tag => ['openstack', 'neutron-package'],
)
is_expected.to contain_package('neutron-server').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron-server').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron-server').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron-server').that_notifies('Anchor[neutron::install::end]')
else
is_expected.to contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
is_expected.to contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
should contain_package('neutron').that_requires('Anchor[neutron::install::begin]')
should contain_package('neutron').that_notifies('Anchor[neutron::install::end]')
end
end
it 'configures neutron server service' do
is_expected.to contain_service('neutron-server').with(
should contain_service('neutron-server').with(
:name => platform_params[:server_service],
:enable => true,
:ensure => 'running',
:tag => ['neutron-service', 'neutron-db-sync-service', 'neutron-server-eventlet'],
)
is_expected.to contain_service('neutron-server').that_subscribes_to('Anchor[neutron::service::begin]')
is_expected.to contain_service('neutron-server').that_notifies('Anchor[neutron::service::end]')
is_expected.not_to contain_class('neutron::db::sync')
is_expected.to contain_service('neutron-server').with_name('neutron-server')
is_expected.to contain_neutron_config('DEFAULT/api_workers').with_value(facts[:os_workers])
is_expected.to contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:os_workers])
is_expected.to contain_neutron_config('DEFAULT/agent_down_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/enable_new_agents').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('DEFAULT/router_scheduler_driver').with_value(p[:router_scheduler_driver])
is_expected.to contain_oslo__middleware('neutron_config').with(
should contain_service('neutron-server').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-server').that_notifies('Anchor[neutron::service::end]')
should_not contain_class('neutron::db::sync')
should contain_service('neutron-server').with_name('neutron-server')
should contain_neutron_config('DEFAULT/api_workers').with_value(facts[:os_workers])
should contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:os_workers])
should contain_neutron_config('DEFAULT/agent_down_time').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/enable_new_agents').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/router_scheduler_driver').with_value(p[:router_scheduler_driver])
should contain_oslo__middleware('neutron_config').with(
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>',
)
is_expected.to contain_neutron_config('DEFAULT/ovs_integration_bridge').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/ovs_integration_bridge').with_value('<SERVICE DEFAULT>')
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-server').without_ensure
should contain_service('neutron-server').without_ensure
end
end
@ -96,8 +91,9 @@ describe 'neutron::server' do
before :each do
params.merge!(:router_distributed => true)
end
it 'should enable DVR for new routers' do
is_expected.to contain_neutron_config('DEFAULT/router_distributed').with_value(true)
should contain_neutron_config('DEFAULT/router_distributed').with_value(true)
end
end
@ -105,8 +101,9 @@ describe 'neutron::server' do
before :each do
params.merge!(:enable_dvr => false)
end
it 'should disable DVR' do
is_expected.to contain_neutron_config('DEFAULT/enable_dvr').with_value(false)
should contain_neutron_config('DEFAULT/enable_dvr').with_value(false)
end
end
@ -114,10 +111,11 @@ describe 'neutron::server' do
before :each do
params.merge!(:l3_ha => true)
end
it 'should enable HA routers' do
is_expected.to contain_neutron_config('DEFAULT/l3_ha').with_value(true)
is_expected.to contain_neutron_config('DEFAULT/max_l3_agents_per_router').with_value(3)
is_expected.to contain_neutron_config('DEFAULT/l3_ha_net_cidr').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/l3_ha').with_value(true)
should contain_neutron_config('DEFAULT/max_l3_agents_per_router').with_value(3)
should contain_neutron_config('DEFAULT/l3_ha_net_cidr').with_value('<SERVICE DEFAULT>')
end
end
@ -125,10 +123,11 @@ describe 'neutron::server' do
before :each do
params.merge!(:l3_ha => false)
end
it 'should disable HA routers' do
is_expected.to contain_neutron_config('DEFAULT/l3_ha').with_value(false)
is_expected.to contain_neutron_config('DEFAULT/max_l3_agents_per_router').with_value(3)
is_expected.to contain_neutron_config('DEFAULT/l3_ha_net_cidr').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/l3_ha').with_value(false)
should contain_neutron_config('DEFAULT/max_l3_agents_per_router').with_value(3)
should contain_neutron_config('DEFAULT/l3_ha_net_cidr').with_value('<SERVICE DEFAULT>')
end
end
@ -137,26 +136,27 @@ describe 'neutron::server' do
params.merge!(:l3_ha => true,
:max_l3_agents_per_router => 0 )
end
it 'should enable HA routers' do
is_expected.to contain_neutron_config('DEFAULT/max_l3_agents_per_router').with_value(0)
should contain_neutron_config('DEFAULT/max_l3_agents_per_router').with_value(0)
end
end
context 'with allow_automatic_l3agent_failover in neutron.conf' do
it 'should configure allow_automatic_l3agent_failover' do
is_expected.to contain_neutron_config('DEFAULT/allow_automatic_l3agent_failover').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/allow_automatic_l3agent_failover').with_value('<SERVICE DEFAULT>')
end
end
context 'with allow_automatic_dhcp_failover in neutron.conf' do
it 'should configure allow_automatic_dhcp_failover' do
is_expected.to contain_neutron_config('DEFAULT/allow_automatic_dhcp_failover').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/allow_automatic_dhcp_failover').with_value('<SERVICE DEFAULT>')
end
end
context 'with network_auto_schedule in neutron.conf' do
it 'should configure network_auto_schedule' do
is_expected.to contain_neutron_config('DEFAULT/network_auto_schedule').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('DEFAULT/network_auto_schedule').with_value('<SERVICE DEFAULT>')
end
end
@ -165,7 +165,7 @@ describe 'neutron::server' do
params.merge!(:dhcp_load_type => 'badvalue')
end
it_raises 'a Puppet::Error', /Must pass either networks, subnets, or ports as values for dhcp_load_type/
it { should raise_error(Puppet::Error, /Must pass either networks, subnets, or ports as values for dhcp_load_type/) }
end
context 'with multiple service providers' do
@ -176,7 +176,7 @@ describe 'neutron::server' do
end
it 'configures neutron.conf' do
is_expected.to contain_neutron_config(
should contain_neutron_config(
'service_providers/service_provider'
).with_value(['provider1', 'provider2'])
end
@ -184,35 +184,35 @@ describe 'neutron::server' do
context 'with availability zone hints set' do
before :each do
params.merge!(:dhcp_load_type => 'networks',
:router_scheduler_driver => 'neutron.scheduler.l3_agent_scheduler.AZLeastRoutersScheduler',
:network_scheduler_driver => 'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler',
:default_availability_zones => ['zone1', 'zone2']
params.merge!( :dhcp_load_type => 'networks',
:router_scheduler_driver => 'neutron.scheduler.l3_agent_scheduler.AZLeastRoutersScheduler',
:network_scheduler_driver => 'neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler',
:default_availability_zones => ['zone1', 'zone2']
)
end
it 'should configure neutron server for availability zones' do
is_expected.to contain_neutron_config('DEFAULT/default_availability_zones').with_value('zone1,zone2')
is_expected.to contain_neutron_config('DEFAULT/router_scheduler_driver').with_value('neutron.scheduler.l3_agent_scheduler.AZLeastRoutersScheduler')
is_expected.to contain_neutron_config('DEFAULT/network_scheduler_driver').with_value('neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler')
is_expected.to contain_neutron_config('DEFAULT/dhcp_load_type').with_value('networks')
should contain_neutron_config('DEFAULT/default_availability_zones').with_value('zone1,zone2')
should contain_neutron_config('DEFAULT/router_scheduler_driver').with_value('neutron.scheduler.l3_agent_scheduler.AZLeastRoutersScheduler')
should contain_neutron_config('DEFAULT/network_scheduler_driver').with_value('neutron.scheduler.dhcp_agent_scheduler.AZAwareWeightScheduler')
should contain_neutron_config('DEFAULT/dhcp_load_type').with_value('networks')
end
end
context 'with enable_proxy_headers_parsing' do
before :each do
params.merge!({:enable_proxy_headers_parsing => true })
params.merge!( :enable_proxy_headers_parsing => true )
end
it { is_expected.to contain_oslo__middleware('neutron_config').with(
it { should contain_oslo__middleware('neutron_config').with(
:enable_proxy_headers_parsing => true,
)}
end
context 'when running neutron-api in wsgi' do
before :each do
params.merge!({ :service_name => 'httpd' })
params.merge!( :service_name => 'httpd' )
end
let :pre_condition do
@ -224,7 +224,7 @@ describe 'neutron::server' do
end
it 'configures neutron-api service with Apache' do
is_expected.to contain_service('neutron-server').with(
should contain_service('neutron-server').with(
:ensure => 'stopped',
:name => platform_params[:server_service],
:enable => false,
@ -239,7 +239,7 @@ describe 'neutron::server' do
end
it 'configures neutron-api service with custom name' do
is_expected.to contain_service('neutron-server').with(
should contain_service('neutron-server').with(
:name => 'foobar',
:enable => true,
:ensure => 'running',
@ -253,114 +253,107 @@ describe 'neutron::server' do
params.merge!({:ovs_integration_bridge => 'br-int' })
end
it { is_expected.to contain_neutron_config('DEFAULT/ovs_integration_bridge').with_value('br-int') }
it { should contain_neutron_config('DEFAULT/ovs_integration_bridge').with_value('br-int') }
end
end
shared_examples_for 'VPNaaS and FWaaS package installation' do
shared_examples 'VPNaaS and FWaaS package installation' do
before do
params.merge!(
:ensure_vpnaas_package => true,
:ensure_fwaas_package => true,
)
end
it 'should install *aaS packages' do
is_expected.to contain_package('neutron-fwaas')
is_expected.to contain_package('neutron-vpnaas-agent')
should contain_package('neutron-fwaas')
should contain_package('neutron-vpnaas-agent')
end
end
shared_examples_for 'neutron server dynamic routing debian' do
shared_examples 'neutron server dynamic routing on Debian' do
before do
params.merge!( :ensure_dr_package => true )
end
it 'should install dynamic routing package' do
is_expected.to contain_package('neutron-dynamic-routing')
is_expected.not_to contain_package('neutron-bgp-dragent')
should contain_package('neutron-dynamic-routing')
should_not contain_package('neutron-bgp-dragent')
end
end
shared_examples_for 'neutron server dynamic routing redhat' do
shared_examples 'neutron server dynamic routing on RedHat' do
before do
params.merge!( :ensure_dr_package => true )
end
it 'should install bgp dragent package' do
is_expected.not_to contain_package('neutron-dynamic-routing')
is_expected.to contain_package('neutron-bgp-dragent')
should_not contain_package('neutron-dynamic-routing')
should contain_package('neutron-bgp-dragent')
end
end
shared_examples_for 'neutron server lbaas debian' do
shared_examples 'neutron server lbaas on Debian' do
before do
params.merge!( :ensure_lbaas_package => true )
end
it 'should install lbaas package' do
is_expected.to contain_package('neutron-lbaas')
is_expected.not_to contain_package('neutron-lbaasv2-agent')
should contain_package('neutron-lbaas')
should_not contain_package('neutron-lbaasv2-agent')
end
end
shared_examples_for 'neutron server lbaas redhat' do
shared_examples 'neutron server lbaas on RedHat' do
before do
params.merge!( :ensure_lbaas_package => true )
end
it 'should install lbaasv2-agent package' do
is_expected.not_to contain_package('neutron-lbaas')
is_expected.to contain_package('neutron-lbaasv2-agent')
should_not contain_package('neutron-lbaas')
should contain_package('neutron-lbaasv2-agent')
end
end
shared_examples_for 'a neutron server without database synchronization' do
shared_examples 'a neutron server without database synchronization' do
before do
params.merge!(
:sync_db => true
)
end
it 'includes neutron::db::sync' do
is_expected.to contain_class('neutron::db::sync')
should contain_class('neutron::db::sync')
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
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
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:server_package => 'neutron-server',
:server_service => 'neutron-server'
}
when 'RedHat'
{
:server_service => 'neutron-server'
}
end
end
it_behaves_like 'a neutron server'
it_behaves_like 'a neutron server without database synchronization'
it_behaves_like "neutron server dynamic routing on #{facts[:osfamily]}"
it_behaves_like "neutron server lbaas on #{facts[:osfamily]}"
end
let :platform_params do
{ :server_package => 'neutron-server',
:server_service => 'neutron-server' }
end
it_configures 'a neutron server'
it_configures 'a neutron server without database synchronization'
it_configures 'neutron server dynamic routing debian'
it_configures 'neutron server lbaas debian'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
let :platform_params do
{ :server_service => 'neutron-server' }
end
it_configures 'a neutron server'
it_configures 'a neutron server without database synchronization'
it_configures 'neutron server dynamic routing redhat'
it_configures 'neutron server lbaas redhat'
end
end

View File

@ -17,30 +17,29 @@
require 'spec_helper'
describe 'neutron::services::bgpvpn' do
let :default_params do
{ :package_ensure => 'present',
{
:package_ensure => 'present',
:service_providers => '<SERVICE DEFAULT>',
:sync_db => true,
}
end
shared_examples_for 'neutron bgpvpn service plugin' do
shared_examples 'neutron bgpvpn service plugin' do
context 'with default params' do
let :params do
default_params
end
it 'installs bgpvpn package' do
is_expected.to contain_package('python-networking-bgpvpn').with(
should contain_package('python-networking-bgpvpn').with(
:ensure => params[:package_ensure],
:name => platform_params[:bgpvpn_package_name],
)
end
it 'runs neutron-db-sync' do
is_expected.to contain_exec('bgpvpn-db-sync').with(
should contain_exec('bgpvpn-db-sync').with(
:command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-bgpvpn upgrade head',
:path => '/usr/bin',
:subscribe => ['Anchor[neutron::install::end]',
@ -61,7 +60,7 @@ describe 'neutron::services::bgpvpn' do
end
it 'configures networking_bgpvpn.conf' do
is_expected.to contain_neutron_bgpvpn_service_config(
should contain_neutron_bgpvpn_service_config(
'service_providers/service_provider'
).with_value(['provider1', 'provider2'])
end
@ -84,7 +83,7 @@ describe 'neutron::services::bgpvpn' do
{ :bgpvpn_package_name => 'python-networking-bgpvpn' }
end
end
it_configures 'neutron bgpvpn service plugin'
it_behaves_like 'neutron bgpvpn service plugin'
end
end
end

View File

@ -26,59 +26,44 @@ describe 'neutron::services::fwaas' do
include ::neutron::agents::l3"
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
let :params do
{}
end
let :default_params do
{ :vpnaas_agent_package => false,
:purge_config => false, }
{
:vpnaas_agent_package => false,
:purge_config => false,
}
end
shared_examples_for 'neutron fwaas service plugin' do
shared_examples 'neutron fwaas service plugin' do
let :params_hash do
default_params.merge(params)
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_fwaas_service_config').with({
should contain_resources('neutron_fwaas_service_config').with({
:purge => false
})
end
it 'configures driver in fwaas_driver.ini' do
is_expected.to contain_neutron_fwaas_service_config('fwaas/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_fwaas_service_config('fwaas/enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_fwaas_service_config('fwaas/agent_version').with_value('<SERVICE DEFAULT>')
should contain_neutron_fwaas_service_config('fwaas/driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_fwaas_service_config('fwaas/enabled').with_value('<SERVICE DEFAULT>')
should contain_neutron_fwaas_service_config('fwaas/agent_version').with_value('<SERVICE DEFAULT>')
end
it 'configures driver in neutron.conf' do
is_expected.to contain_neutron_config('fwaas/driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('fwaas/enabled').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('fwaas/agent_version').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('fwaas/driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('fwaas/enabled').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('fwaas/agent_version').with_value('<SERVICE DEFAULT>')
end
end
context 'on Ubuntu platforms' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'Debian',
:operatingsystem => 'Ubuntu',
:os => { :name => 'Ubuntu', :family => 'Debian', :release => { :major => '16', :minor => '04' } },
}
))
end
it_configures 'neutron fwaas service plugin'
shared_examples 'neutron::services::fwaas on Ubuntu' do
it 'installs neutron fwaas package' do
is_expected.to contain_package('neutron-fwaas').with(
should contain_package('neutron-fwaas').with(
:ensure => 'present',
:tag => ['neutron-package', 'openstack'],
:name => 'python-neutron-fwaas',
@ -86,66 +71,64 @@ describe 'neutron::services::fwaas' do
end
end
context 'on Debian platforms without VPNaaS' do
let :facts do
@default_facts.merge(test_facts.merge(
{ :osfamily => 'Debian',
:operatingsystem => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}
))
shared_examples 'neutron::services::fwaas on Debian' do
context 'without VPNaaS package' do
it 'installs neutron fwaas package' do
should contain_package('neutron-fwaas').with(
:ensure => 'present',
:tag => ['neutron-package', 'openstack'],
:name => 'python-neutron-fwaas',
)
end
end
it_configures 'neutron fwaas service plugin'
context 'with VPNaaS package' do
before do
params.merge!( :vpnaas_agent_package => true )
end
it 'installs neutron fwaas package' do
is_expected.to contain_package('neutron-fwaas').with(
:ensure => 'present',
:tag => ['neutron-package', 'openstack'],
:name => 'python-neutron-fwaas',
)
it 'installs neutron vpnaas agent package' do
should contain_package('neutron-vpn-agent').with(
:ensure => 'present',
:tag => ['neutron-package', 'openstack'],
)
end
end
end
context 'on Debian platforms with VPNaaS' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
}))
end
let :params do
{ :vpnaas_agent_package => true }
end
it_configures 'neutron fwaas service plugin'
it 'installs neutron vpnaas agent package' do
is_expected.to contain_package('neutron-vpn-agent').with(
:ensure => 'present',
:tag => ['neutron-package', 'openstack'],
)
end
end
context 'on Red Hat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
}))
end
it_configures 'neutron fwaas service plugin'
shared_examples 'neutron::services::fwaas on RedHat' do
it 'installs neutron fwaas service package' do
is_expected.to contain_package('neutron-fwaas').with(
should contain_package('neutron-fwaas').with(
:ensure => 'present',
:name => 'openstack-neutron-fwaas',
)
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
let (:platform_params) do
{}
end
it_behaves_like 'neutron fwaas service plugin'
case facts[:operatingsystem]
when 'Debian'
it_behaves_like 'neutron::services::fwaas on Debian'
when 'Ubuntu'
it_behaves_like 'neutron::services::fwaas on Ubuntu'
end
if facts[:osfamily] == 'RedHat'
it_behaves_like 'neutron::services::fwaas on RedHat'
end
end
end
end

View File

@ -17,7 +17,6 @@
require 'spec_helper'
describe 'neutron::services::l2gw' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
@ -36,58 +35,49 @@ describe 'neutron::services::l2gw' do
{ :default_interface_name => 'foo'}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default'
}
end
shared_examples_for 'neutron l2gw service plugin' do
shared_examples 'neutron l2gw service plugin' do
context 'with default params' do
let :p do
default_params.merge(params)
end
it 'passes purge to resource' do
is_expected.to contain_resources('neutron_l2gw_service_config').with({
should contain_resources('neutron_l2gw_service_config').with({
:purge => false
})
end
it 'should contain python-networking-l2gw package' do
is_expected.to contain_package('python-networking-l2gw').with({ :ensure => 'present' })
should contain_package('python-networking-l2gw').with({ :ensure => 'present' })
end
it 'services_provider with default parameter' do
is_expected.to contain_neutron_l2gw_service_config('service_providers/service_provider').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_service_config('service_providers/service_provider').with_value('<SERVICE DEFAULT>')
end
it 'configures l2gw_plugin.ini' do
is_expected.to contain_neutron_l2gw_service_config('DEFAULT/default_interface_name').with_value(p[:default_interface_name])
is_expected.to contain_neutron_l2gw_service_config('DEFAULT/default_device_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_service_config('DEFAULT/quota_l2_gateway').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_service_config('DEFAULT/periodic_monitoring_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_l2gw_service_config('service_providers/service_provider').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_service_config('DEFAULT/default_interface_name').with_value(p[:default_interface_name])
should contain_neutron_l2gw_service_config('DEFAULT/default_device_name').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_service_config('DEFAULT/quota_l2_gateway').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_service_config('DEFAULT/periodic_monitoring_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_l2gw_service_config('service_providers/service_provider').with_value('<SERVICE DEFAULT>')
end
end
context 'with multiple service providers' do
before :each do
params.merge!(
{ :service_providers => ['provider1', 'provider2'],
:sync_db => true,
}
)
params.merge!( :service_providers => ['provider1', 'provider2'],
:sync_db => true )
end
it 'configures multiple service providers in l2gw_plugin.ini' do
is_expected.to contain_neutron_l2gw_service_config(
should contain_neutron_l2gw_service_config(
'service_providers/service_provider'
).with_value(['provider1', 'provider2'])
end
it 'runs neutron-db-sync' do
is_expected.to contain_exec('l2gw-db-sync').with(
should contain_exec('l2gw-db-sync').with(
:command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-l2gw upgrade head',
:path => '/usr/bin',
:subscribe => ['Anchor[neutron::install::end]',
@ -118,7 +108,7 @@ describe 'neutron::services::l2gw' do
end
end
it_configures 'neutron l2gw service plugin'
it_behaves_like 'neutron l2gw service plugin'
end
end
end

View File

@ -21,9 +21,9 @@
require 'spec_helper'
describe 'neutron::services::lbaas::haproxy' do
let :default_params do
{ :interface_driver => '<SERVICE DEFAULT>',
{
:interface_driver => '<SERVICE DEFAULT>',
:periodic_interval => '<SERVICE DEFAULT>',
:loadbalancer_state_path => '<SERVICE DEFAULT>',
:user_group => '<SERVICE DEFAULT>',
@ -31,33 +31,48 @@ describe 'neutron::services::lbaas::haproxy' do
:jinja_config_template => '<SERVICE DEFAULT>'}
end
context 'with default params' do
let :params do
default_params
shared_examples 'neutron::services::lbaas::haproxy' do
context 'with default params' do
let :params do
default_params
end
it 'configures haproxy service plugin' do
should contain_neutron_config('haproxy/interface_driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('haproxy/periodic_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('haproxy/loadbalancer_state_path').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('haproxy/user_group').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('haproxy/send_gratuitous_arp').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('haproxy/jinja_config_template').with_value('<SERVICE DEFAULT>')
end
end
it 'configures haproxy service plugin' do
is_expected.to contain_neutron_config('haproxy/interface_driver').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('haproxy/periodic_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('haproxy/loadbalancer_state_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('haproxy/user_group').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('haproxy/send_gratuitous_arp').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('haproxy/jinja_config_template').with_value('<SERVICE DEFAULT>')
context 'when interface driver and gratuitous arp is set' do
let :params do
default_params.merge(
{
:interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
:send_gratuitous_arp => true,
}
)
end
it 'configures haproxy service plugin custom parameters' do
should contain_neutron_config('haproxy/interface_driver').with_value('neutron.agent.linux.interface.OVSInterfaceDriver')
should contain_neutron_config('haproxy/send_gratuitous_arp').with_value(true)
end
end
end
context 'when interface driver and gratuitous arp is set' do
let :params do
default_params.merge(
{ :interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
:send_gratuitous_arp => true,
}
)
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 'configures haproxy service plugin custom parameters' do
is_expected.to contain_neutron_config('haproxy/interface_driver').with_value('neutron.agent.linux.interface.OVSInterfaceDriver')
is_expected.to contain_neutron_config('haproxy/send_gratuitous_arp').with_value(true)
it_behaves_like 'neutron::services::lbaas::haproxy'
end
end
end

View File

@ -21,9 +21,9 @@
require 'spec_helper'
describe 'neutron::services::lbaas::octavia' do
let :default_params do
{ :base_url => 'http://127.0.0.1:9876',
{
:base_url => 'http://127.0.0.1:9876',
:request_poll_interval => '<SERVICE DEFAULT>',
:request_poll_timeout => '<SERVICE DEFAULT>',
:allocates_vip => '<SERVICE DEFAULT>',
@ -38,98 +38,115 @@ describe 'neutron::services::lbaas::octavia' do
:insecure => '<SERVICE DEFAULT>' }
end
context 'with default params' do
let :params do
default_params
shared_examples 'neutron::services::lbaas::octavia' do
context 'with default params' do
let :params do
default_params
end
it 'configures octavia service plugin' do
should contain_neutron_config('octavia/base_url').with_value('http://127.0.0.1:9876')
should contain_neutron_config('octavia/request_poll_interval').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('octavia/request_poll_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('octavia/allocates_vip').with_value('<SERVICE DEFAULT>')
end
it 'configures octavia service authentication' do
should contain_neutron_config('service_auth/auth_url').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_user').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_tenant_name').with_value('services')
should contain_neutron_config('service_auth/admin_password').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_user_domain').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_project_domain').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/auth_version').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/endpoint_type').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/insecure').with_value('<SERVICE DEFAULT>')
end
end
it 'configures octavia service plugin' do
is_expected.to contain_neutron_config('octavia/base_url').with_value('http://127.0.0.1:9876')
is_expected.to contain_neutron_config('octavia/request_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('octavia/request_poll_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('octavia/allocates_vip').with_value('<SERVICE DEFAULT>')
context 'when base_url is set' do
let :params do
default_params.merge(
{
:base_url => 'http://octavia.example.org:9876',
:request_poll_interval => '3',
:request_poll_timeout => '100',
:allocates_vip => 'false'
}
)
end
it 'configures octavia service plugin custom parameters' do
should contain_neutron_config('octavia/base_url').with_value('http://octavia.example.org:9876')
should contain_neutron_config('octavia/request_poll_interval').with_value('3')
should contain_neutron_config('octavia/request_poll_timeout').with_value('100')
should contain_neutron_config('octavia/allocates_vip').with_value('false')
end
it 'configures octavia service authentication' do
should contain_neutron_config('service_auth/auth_url').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_user').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_tenant_name').with_value('services')
should contain_neutron_config('service_auth/admin_password').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_user_domain').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/admin_project_domain').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/auth_version').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/endpoint_type').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('service_auth/insecure').with_value('<SERVICE DEFAULT>')
end
end
it 'configures octavia service authentication' do
is_expected.to contain_neutron_config('service_auth/auth_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_user').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_tenant_name').with_value('services')
is_expected.to contain_neutron_config('service_auth/admin_password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_user_domain').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_project_domain').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/auth_version').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/endpoint_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/insecure').with_value('<SERVICE DEFAULT>')
context 'when base_url and service credentials are set' do
let :params do
default_params.merge(
{
:base_url => 'http://octavia.example.org:9876',
:request_poll_interval => '3',
:request_poll_timeout => '100',
:allocates_vip => 'false',
:auth_url => 'https://auth.openstack.cloud/v3',
:admin_user => 'admin',
:admin_tenant_name => 'service-tenant',
:admin_password => 'secure123',
:admin_user_domain => 'DefaultUsers',
:admin_project_domain => 'DefaultProjects',
:auth_version => '3',
:endpoint_type => 'public',
:insecure => 'false'
}
)
end
it 'configures octavia service plugin custom parameters' do
should contain_neutron_config('octavia/base_url').with_value('http://octavia.example.org:9876')
should contain_neutron_config('octavia/request_poll_interval').with_value('3')
should contain_neutron_config('octavia/request_poll_timeout').with_value('100')
should contain_neutron_config('octavia/allocates_vip').with_value('false')
end
it 'configures octavia service authentication' do
should contain_neutron_config('service_auth/auth_url').with_value('https://auth.openstack.cloud/v3')
should contain_neutron_config('service_auth/admin_user').with_value('admin')
should contain_neutron_config('service_auth/admin_tenant_name').with_value('service-tenant')
should contain_neutron_config('service_auth/admin_password').with_value('secure123')
should contain_neutron_config('service_auth/admin_user_domain').with_value('DefaultUsers')
should contain_neutron_config('service_auth/admin_project_domain').with_value('DefaultProjects')
should contain_neutron_config('service_auth/auth_version').with_value('3')
should contain_neutron_config('service_auth/endpoint_type').with_value('public')
should contain_neutron_config('service_auth/insecure').with_value('false')
end
end
end
context 'when base_url is set' do
let :params do
default_params.merge(
{ :base_url => 'http://octavia.example.org:9876',
:request_poll_interval => '3',
:request_poll_timeout => '100',
:allocates_vip => 'false'
}
)
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 'configures octavia service plugin custom parameters' do
is_expected.to contain_neutron_config('octavia/base_url').with_value('http://octavia.example.org:9876')
is_expected.to contain_neutron_config('octavia/request_poll_interval').with_value('3')
is_expected.to contain_neutron_config('octavia/request_poll_timeout').with_value('100')
is_expected.to contain_neutron_config('octavia/allocates_vip').with_value('false')
end
it 'configures octavia service authentication' do
is_expected.to contain_neutron_config('service_auth/auth_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_user').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_tenant_name').with_value('services')
is_expected.to contain_neutron_config('service_auth/admin_password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_user_domain').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/admin_project_domain').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/auth_version').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/endpoint_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('service_auth/insecure').with_value('<SERVICE DEFAULT>')
end
end
context 'when base_url and service credentials are set' do
let :params do
default_params.merge(
{ :base_url => 'http://octavia.example.org:9876',
:request_poll_interval => '3',
:request_poll_timeout => '100',
:allocates_vip => 'false',
:auth_url => 'https://auth.openstack.cloud/v3',
:admin_user => 'admin',
:admin_tenant_name => 'service-tenant',
:admin_password => 'secure123',
:admin_user_domain => 'DefaultUsers',
:admin_project_domain => 'DefaultProjects',
:auth_version => '3',
:endpoint_type => 'public',
:insecure => 'false' }
)
end
it 'configures octavia service plugin custom parameters' do
is_expected.to contain_neutron_config('octavia/base_url').with_value('http://octavia.example.org:9876')
is_expected.to contain_neutron_config('octavia/request_poll_interval').with_value('3')
is_expected.to contain_neutron_config('octavia/request_poll_timeout').with_value('100')
is_expected.to contain_neutron_config('octavia/allocates_vip').with_value('false')
end
it 'configures octavia service authentication' do
is_expected.to contain_neutron_config('service_auth/auth_url').with_value('https://auth.openstack.cloud/v3')
is_expected.to contain_neutron_config('service_auth/admin_user').with_value('admin')
is_expected.to contain_neutron_config('service_auth/admin_tenant_name').with_value('service-tenant')
is_expected.to contain_neutron_config('service_auth/admin_password').with_value('secure123')
is_expected.to contain_neutron_config('service_auth/admin_user_domain').with_value('DefaultUsers')
is_expected.to contain_neutron_config('service_auth/admin_project_domain').with_value('DefaultProjects')
is_expected.to contain_neutron_config('service_auth/auth_version').with_value('3')
is_expected.to contain_neutron_config('service_auth/endpoint_type').with_value('public')
is_expected.to contain_neutron_config('service_auth/insecure').with_value('false')
it_behaves_like 'neutron::services::lbaas::octavia'
end
end
end

View File

@ -21,12 +21,11 @@
require 'spec_helper'
describe 'neutron::services::lbaas' do
let :default_params do
{}
end
shared_examples_for 'neutron lbaas service plugin' do
shared_examples 'neutron lbaas service plugin' do
context 'with default params' do
let :params do
@ -34,13 +33,13 @@ describe 'neutron::services::lbaas' do
end
it 'should contain python-neutron-lbaas package' do
is_expected.to contain_package('python-neutron-lbaas').with({ :ensure => 'present' })
should contain_package('python-neutron-lbaas').with({ :ensure => 'present' })
end
it 'should set certificates options with service defaults' do
is_expected.to contain_neutron_config('certificates/cert_manager_type').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('certificates/storage_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_config('certificates/barbican_auth').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('certificates/cert_manager_type').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('certificates/storage_path').with_value('<SERVICE DEFAULT>')
should contain_neutron_config('certificates/barbican_auth').with_value('<SERVICE DEFAULT>')
end
end
@ -54,42 +53,23 @@ describe 'neutron::services::lbaas' do
)
it 'should configure certificates section' do
is_expected.to contain_neutron_config('certificates/cert_manager_type').with_value('barbican')
is_expected.to contain_neutron_config('certificates/storage_path').with_value('/var/lib/neutron-lbaas/certificates/')
is_expected.to contain_neutron_config('certificates/barbican_auth').with_value('barbican_acl_auth')
should contain_neutron_config('certificates/cert_manager_type').with_value('barbican')
should contain_neutron_config('certificates/storage_path').with_value('/var/lib/neutron-lbaas/certificates/')
should contain_neutron_config('certificates/barbican_auth').with_value('barbican_acl_auth')
end
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
})
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 'neutron lbaas service plugin'
end
let :platform_params do
{}
end
it_configures 'neutron lbaas service plugin'
end
context 'on Red Hat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
})
end
let :platform_params do
{}
end
it_configures 'neutron lbaas service plugin'
end
end

View File

@ -17,7 +17,6 @@
require 'spec_helper'
describe 'neutron::services::sfc' do
let :default_params do
{ :package_ensure => 'present',
:sfc_driver => '<SERVICE DEFAULT>',
@ -26,7 +25,7 @@ describe 'neutron::services::sfc' do
}
end
shared_examples_for 'neutron sfc service plugin' do
shared_examples 'neutron sfc service plugin' do
context 'with default params' do
let :params do
@ -34,14 +33,14 @@ describe 'neutron::services::sfc' do
end
it 'installs sfc package' do
is_expected.to contain_package('python-networking-sfc').with(
should contain_package('python-networking-sfc').with(
:ensure => params[:package_ensure],
:name => platform_params[:sfc_package_name],
)
end
it 'runs neutron-db-sync' do
is_expected.to contain_exec('sfc-db-sync').with(
should contain_exec('sfc-db-sync').with(
:command => 'neutron-db-manage --config-file /etc/neutron/neutron.conf --subproject networking-sfc upgrade head',
:path => '/usr/bin',
:subscribe => ['Anchor[neutron::install::end]',
@ -64,10 +63,10 @@ describe 'neutron::services::sfc' do
end
it 'configures networking-sfc.conf' do
is_expected.to contain_neutron_sfc_service_config(
should contain_neutron_sfc_service_config(
'sfc/drivers'
).with_value('odl_v2')
is_expected.to contain_neutron_sfc_service_config(
should contain_neutron_sfc_service_config(
'flowclassifier/drivers'
).with_value('odl_v2')
end
@ -90,7 +89,7 @@ describe 'neutron::services::sfc' do
{ :sfc_package_name => 'python-networking-sfc' }
end
end
it_configures 'neutron sfc service plugin'
it_behaves_like 'neutron sfc service plugin'
end
end
end

View File

@ -19,21 +19,21 @@
require 'spec_helper'
describe 'neutron::services::vpnaas' do
let :default_params do
{ :package_ensure => 'present',
:service_providers => '<SERVICE DEFAULT>'}
{
:package_ensure => 'present',
:service_providers => '<SERVICE DEFAULT>'
}
end
shared_examples_for 'neutron vpnaas service plugin' do
shared_examples 'neutron vpnaas service plugin' do
context 'with default params' do
let :params do
default_params
end
it 'installs vpnaas package' do
is_expected.to contain_package('neutron-vpnaas-agent').with(
should contain_package('neutron-vpnaas-agent').with(
:ensure => params[:package_ensure],
:name => platform_params[:vpnaas_package_name],
)
@ -48,43 +48,35 @@ describe 'neutron::services::vpnaas' do
end
it 'configures neutron_vpnaas.conf' do
is_expected.to contain_neutron_vpnaas_service_config(
should contain_neutron_vpnaas_service_config(
'service_providers/service_provider'
).with_value(['provider1', 'provider2'])
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'Debian',
:os => { :name => 'Debian', :family => 'Debian', :release => { :major => '8', :minor => '0' } },
})
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
let :platform_params do
{ :vpnaas_package_name => 'neutron-vpn-agent'}
end
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:vpnaas_package_name => 'neutron-vpn-agent'
}
when 'RedHat'
{
:vpnaas_package_name => 'openstack-neutron-vpnaas'
}
end
end
it_configures 'neutron vpnaas service plugin'
it_behaves_like 'neutron vpnaas service plugin'
end
end
context 'on Red Hat platforms' do
let :facts do
@default_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7',
:os => { :name => 'CentOS', :family => 'RedHat', :release => { :major => '7', :minor => '0' } },
})
end
let :platform_params do
{ :vpnaas_package_name => 'openstack-neutron-vpnaas'}
end
it_configures 'neutron vpnaas service plugin'
end
end

View File

@ -1,14 +1,13 @@
require 'spec_helper'
describe 'neutron::wsgi::apache' do
shared_examples_for 'apache serving neutron with mod_wsgi' do
shared_examples 'apache serving neutron with mod_wsgi' do
context 'with default parameters' do
it { is_expected.to contain_class('neutron::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
it { is_expected.to contain_class('apache::mod::ssl') }
it { is_expected.to contain_openstacklib__wsgi__apache('neutron_wsgi').with(
it { should contain_class('neutron::params') }
it { should contain_class('apache') }
it { should contain_class('apache::mod::wsgi') }
it { should contain_class('apache::mod::ssl') }
it { should contain_openstacklib__wsgi__apache('neutron_wsgi').with(
:bind_port => 9696,
:group => 'neutron',
:path => '/',
@ -45,11 +44,11 @@ describe 'neutron::wsgi::apache' do
:error_log_file => '/var/log/httpd/error_log'
}
end
it { is_expected.to contain_class('neutron::params') }
it { is_expected.to contain_class('apache') }
it { is_expected.to contain_class('apache::mod::wsgi') }
it { is_expected.to_not contain_class('apache::mod::ssl') }
it { is_expected.to contain_openstacklib__wsgi__apache('neutron_wsgi').with(
it { should contain_class('neutron::params') }
it { should contain_class('apache') }
it { should contain_class('apache::mod::wsgi') }
it { should_not contain_class('apache::mod::ssl') }
it { should contain_openstacklib__wsgi__apache('neutron_wsgi').with(
:bind_host => '10.42.51.1',
:bind_port => 12345,
:group => 'neutron',
@ -106,7 +105,7 @@ describe 'neutron::wsgi::apache' do
end
end
it_configures 'apache serving neutron with mod_wsgi'
it_behaves_like 'apache serving neutron with mod_wsgi'
end
end
end