From c9dacb2c20ed7d66994670736c5f5f7f45384b3c Mon Sep 17 00:00:00 2001 From: Matthew Black Date: Tue, 19 Apr 2016 13:15:16 -0400 Subject: [PATCH] Added params for debian packages Added the values for Debian osfamily with regards to the ovn packages. Change-Id: Ia6700a33472d44ed37ec6cdd30b80ea56ce65452 --- README.md | 4 +-- manifests/params.pp | 8 ++++- spec/classes/ovn_controller_spec.rb | 53 ++++++++++++++++++----------- spec/classes/ovn_northd_spec.rb | 42 +++++++++++++++-------- 4 files changed, 68 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index fa9d55c..f33f71f 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,7 @@ ## Overview -Puppet module for the OVN project. At the moment this support OVN -installation in Redhat platforms only. One can add the support for -other platforms by defining them in ovn::params module +Puppet module for the OVN project. ## Module Description diff --git a/manifests/params.pp b/manifests/params.pp index aeaa15e..c71fefa 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,7 +1,7 @@ # ovn params # == Class: ovn::params # -# This class defines the variable like +# This class defines the variable like class ovn::params { case $::osfamily { @@ -11,6 +11,12 @@ class ovn::params { $ovn_northd_service_name = 'ovn-northd' $ovn_controller_service_name = 'ovn-controller' } + 'Debian': { + $ovn_northd_package_name = 'ovn-central' + $ovn_controller_package_name = 'ovn-host' + $ovn_northd_service_name = 'ovn-central' + $ovn_controller_service_name = 'ovn-host' + } default: { fail " Osfamily ${::osfamily} not supported yet" } diff --git a/spec/classes/ovn_controller_spec.rb b/spec/classes/ovn_controller_spec.rb index ab75ecd..d663e0c 100644 --- a/spec/classes/ovn_controller_spec.rb +++ b/spec/classes/ovn_controller_spec.rb @@ -2,13 +2,14 @@ require 'spec_helper' describe 'ovn::controller' do - let :redhat_platform_params do { - :ovn_controller_package_name => 'openvswitch-ovn-host', - :ovn_controller_service_name => 'ovn-controller' - } + let :params do + { :ovn_remote => 'tcp:x.x.x.x:5000', + :ovn_encap_type => 'geneve', + :ovn_encap_ip => '1.2.3.4' + } end - shared_examples 'ovn controller' do + shared_examples_for 'ovn controller' do it 'includes params' do is_expected.to contain_class('ovn::params') end @@ -54,21 +55,33 @@ describe 'ovn::controller' do end end - context 'with redhat platform' do - let :params do { - :ovn_remote => 'tcp:x.x.x.x:5000', - :ovn_encap_type => 'geneve', - :ovn_encap_ip => '1.2.3.4' - } + 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 + + case facts[:osfamily] + when 'Debian' + let :platform_params do + { + :ovn_controller_package_name => 'ovn-host', + :ovn_controller_service_name => 'ovn-host' + } + end + it_behaves_like 'ovn controller' + when 'Redhat' + let :platform_params do + { + :ovn_controller_package_name => 'openvswitch-ovn-host', + :ovn_controller_service_name => 'ovn-controller' + } + end + it_behaves_like 'ovn controller' + end end - - let :facts do - {:osfamily => 'Redhat', - } - end - - let :platform_params do redhat_platform_params end - - it_configures 'ovn controller' end end diff --git a/spec/classes/ovn_northd_spec.rb b/spec/classes/ovn_northd_spec.rb index 9fe8cc7..acfcc66 100644 --- a/spec/classes/ovn_northd_spec.rb +++ b/spec/classes/ovn_northd_spec.rb @@ -2,13 +2,7 @@ require 'spec_helper' describe 'ovn::northd' do - let :redhat_platform_params do { - :ovn_northd_package_name => 'openvswitch-ovn-central', - :ovn_northd_service_name => 'ovn-northd' - } - end - - shared_examples 'ovn northd' do + shared_examples_for 'ovn northd' do it 'includes params' do is_expected.to contain_class('ovn::params') end @@ -30,16 +24,34 @@ describe 'ovn::northd' do end end - context 'on redhat' do - let :platform_params do redhat_platform_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 - let :facts do - {:osfamily => 'Redhat', - } + case facts[:osfamily] + when 'Debian' + let(:platform_params) do + { + :ovn_northd_package_name => 'ovn-central', + :ovn_northd_service_name => 'ovn-central' + } + end + it_behaves_like 'ovn northd' + when 'Redhat' + let(:platform_params) do + { + :ovn_northd_package_name => 'openvswitch-ovn-central', + :ovn_northd_service_name => 'ovn-northd' + } + end + it_behaves_like 'ovn northd' + end end - - it_configures 'ovn northd' end - end