summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Albertson <lance@osuosl.org>2016-05-26 15:58:15 -0700
committerLance Albertson <lance@osuosl.org>2016-06-07 19:24:09 -0700
commit8e42ee27c09b466b7b391df84f8da39b30505c6e (patch)
tree9cc59888b1a39025185c8630bf530958e99e7fbc
parentcace7ca3dec16dbaa76351f12aec70491d4da05f (diff)
Set sane defaults for linuxbridge_conf.ini
These defaults are based on upstream documentation [1] and should work in most environments. In addition, add RHEL chefspec tests and also test the config file contents. Without a default config of any kind, the plugin_config recipe fails due to an empty attribute. [1] http://docs.openstack.org/mitaka/install-guide-rdo/neutron.html Change-Id: I037e51f40db5f73c8b9a3f6289287e82fb73f8a6 Signed-off-by: Lance Albertson <lance@osuosl.org>
Notes
Notes (review): Code-Review+2: Mark Vanderwiel <vanderwl@us.ibm.com> Workflow+1: Jan Klare <j.klare@cloudbau.de> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 13 Jun 2016 11:59:46 +0000 Reviewed-on: https://review.openstack.org/321888 Project: openstack/cookbook-openstack-network Branch: refs/heads/master
-rw-r--r--recipes/ml2_linuxbridge.rb2
-rw-r--r--spec/ml2_linuxbridge-redhat_spec.rb63
-rw-r--r--spec/ml2_linuxbridge_spec.rb14
3 files changed, 79 insertions, 0 deletions
diff --git a/recipes/ml2_linuxbridge.rb b/recipes/ml2_linuxbridge.rb
index 6998c60..8076bed 100644
--- a/recipes/ml2_linuxbridge.rb
+++ b/recipes/ml2_linuxbridge.rb
@@ -40,6 +40,8 @@ node.default['openstack']['network']['plugins']['linuxbridge'].tap do |lb|
40 '/etc/neutron/plugins/linuxbridge' 40 '/etc/neutron/plugins/linuxbridge'
41 lb['filename'] = 41 lb['filename'] =
42 'linuxbridge_conf.ini' 42 'linuxbridge_conf.ini'
43 lb['conf']['securitygroup']['firewall_driver'] =
44 'neutron.agent.linux.iptables_firewall.IptablesFirewallDriver'
43end 45end
44 46
45include_recipe 'openstack-network::plugin_config' 47include_recipe 'openstack-network::plugin_config'
diff --git a/spec/ml2_linuxbridge-redhat_spec.rb b/spec/ml2_linuxbridge-redhat_spec.rb
new file mode 100644
index 0000000..3d2a1ed
--- /dev/null
+++ b/spec/ml2_linuxbridge-redhat_spec.rb
@@ -0,0 +1,63 @@
1# pkg upgrade
2
3# service
4
5# Encoding: utf-8
6require_relative 'spec_helper'
7
8describe 'openstack-network::ml2_linuxbridge' do
9 describe 'redhat' do
10 let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
11 let(:node) { runner.node }
12 let(:chef_run) do
13 runner.converge(described_recipe)
14 end
15
16 include_context 'neutron-stubs'
17
18 before do
19 node.set['openstack']['network']['plugins']['linuxbridge']['path'] =
20 '/etc/neutron/plugins/linuxbridge'
21 node.set['openstack']['network']['plugins']['linuxbridge']['filename'] =
22 'linuxbridge_conf.ini'
23 end
24 it 'creates the /etc/neutron/plugins/linuxbridge agent directory' do
25 expect(chef_run).to create_directory('/etc/neutron/plugins/linuxbridge').with(
26 owner: 'neutron',
27 group: 'neutron',
28 mode: 0700
29 )
30 end
31 it do
32 expect(chef_run).to include_recipe('openstack-network::plugin_config')
33 end
34
35 describe '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini' do
36 let(:file) do
37 chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
38 end
39 [
40 /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
41 ].each do |line|
42 it do
43 expect(chef_run).to render_config_file(file.name)
44 .with_section_content('securitygroup', line)
45 end
46 end
47 end
48
49 it do
50 %w(openstack-neutron-linuxbridge iproute).each do |pkg|
51 expect(chef_run).to upgrade_package(pkg)
52 end
53 end
54
55 it do
56 expect(chef_run).to enable_service('neutron-linuxbridge-agent')
57 end
58 it do
59 service = chef_run.service('neutron-linuxbridge-agent')
60 expect(service).to(subscribe_to('template[/etc/neutron/neutron.conf]').on(:restart).delayed) && subscribe_to('template[/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini]').on(:restart).delayed
61 end
62 end
63end
diff --git a/spec/ml2_linuxbridge_spec.rb b/spec/ml2_linuxbridge_spec.rb
index 6cce9a5..e7f608d 100644
--- a/spec/ml2_linuxbridge_spec.rb
+++ b/spec/ml2_linuxbridge_spec.rb
@@ -33,6 +33,20 @@ describe 'openstack-network::ml2_linuxbridge' do
33 expect(chef_run).to include_recipe('openstack-network::plugin_config') 33 expect(chef_run).to include_recipe('openstack-network::plugin_config')
34 end 34 end
35 35
36 describe '/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini' do
37 let(:file) do
38 chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
39 end
40 [
41 /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
42 ].each do |line|
43 it do
44 expect(chef_run).to render_config_file(file.name)
45 .with_section_content('securitygroup', line)
46 end
47 end
48 end
49
36 it do 50 it do
37 %w(neutron-plugin-linuxbridge neutron-plugin-linuxbridge-agent).each do |pkg| 51 %w(neutron-plugin-linuxbridge neutron-plugin-linuxbridge-agent).each do |pkg|
38 expect(chef_run).to upgrade_package(pkg) 52 expect(chef_run).to upgrade_package(pkg)