53b5f9c077b3f8a82ab54ffda60da1f88ba8e719
[mirror/dsa-puppet.git] / 3rdparty / modules / neutron / spec / classes / neutron_agents_linuxbridge_spec.rb
1 require 'spec_helper'
2
3 describe 'neutron::agents::linuxbridge' do
4
5   let :pre_condition do
6     "class { 'neutron': rabbit_password => 'passw0rd' }\n" +
7     "class { 'neutron::plugins::linuxbridge': }"
8   end
9
10   let :params do
11     { :physical_interface_mappings => 'physnet:eth0',
12       :firewall_driver             => 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver',
13       :package_ensure              => 'present',
14       :enable                      => true
15     }
16   end
17
18   shared_examples_for 'neutron linuxbridge agent' do
19
20     it { should contain_class('neutron::params') }
21
22     it 'configures neutron linuxbridge agent service' do
23       should contain_service('neutron-plugin-linuxbridge-service').with(
24         :ensure  => 'running',
25         :name    => platform_params[:linuxbridge_agent_service],
26         :enable  => params[:enable]
27       )
28     end
29
30     context 'with manage_service as false' do
31       before :each do
32         params.merge!(:manage_service => false)
33       end
34       it 'should not start/stop service' do
35         should contain_service('neutron-plugin-linuxbridge-service').without_ensure
36       end
37     end
38
39     it 'configures linuxbridge_conf.ini' do
40       should contain_neutron_plugin_linuxbridge('LINUX_BRIDGE/physical_interface_mappings').with(
41         :value => params[:physical_interface_mappings]
42       )
43       should contain_neutron_plugin_linuxbridge('SECURITYGROUP/firewall_driver').with(
44         :value => params[:firewall_driver]
45       )
46     end
47   end
48
49
50   context 'on Debian platforms' do
51     let :facts do
52       { :osfamily => 'Debian' }
53     end
54
55     let :platform_params do
56       { :linuxbridge_agent_package => 'neutron-plugin-linuxbridge-agent',
57         :linuxbridge_agent_service => 'neutron-plugin-linuxbridge-agent' }
58     end
59
60     it_configures 'neutron linuxbridge agent'
61
62     it 'installs neutron linuxbridge agent package' do
63       should contain_package('neutron-plugin-linuxbridge-agent').with(
64         :ensure => params[:package_ensure],
65         :name   => platform_params[:linuxbridge_agent_package]
66       )
67     end
68   end
69
70   context 'on RedHat platforms' do
71     let :facts do
72       { :osfamily => 'RedHat' }
73     end
74
75     let :platform_params do
76       { :linuxbridge_server_package => 'openstack-neutron-linuxbridge',
77         :linuxbridge_agent_service => 'neutron-linuxbridge-agent' }
78     end
79
80     it_configures 'neutron linuxbridge agent'
81
82     it 'installs neutron linuxbridge package' do
83       should contain_package('neutron-plugin-linuxbridge').with(
84         :ensure => params[:package_ensure],
85         :name   => platform_params[:linuxbridge_server_package]
86       )
87     end
88   end
89 end