Networking OVN Puppet Module
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

128 lines
4.0 KiB

  1. require 'spec_helper'
  2. describe 'ovn::controller' do
  3. let :params do
  4. { :ovn_remote => 'tcp:x.x.x.x:5000',
  5. :ovn_encap_type => 'geneve',
  6. :ovn_encap_ip => '1.2.3.4',
  7. :ovn_bridge_mappings => ['physnet-1:br-1'],
  8. :ovn_bridge => 'br-int',
  9. :bridge_interface_mappings => ['br-1:eth1'],
  10. :hostname => 'server1.example.com',
  11. :enable_hw_offload => false,
  12. :mac_table_size => 20000,
  13. :ovn_remote_probe_interval => 30000,
  14. :ovn_openflow_probe_interval => 8,
  15. }
  16. end
  17. shared_examples_for 'ovn controller' do
  18. it 'includes params' do
  19. is_expected.to contain_class('ovn::params')
  20. end
  21. it 'includes controller' do
  22. is_expected.to contain_class('ovn::controller')
  23. end
  24. it 'starts controller' do
  25. is_expected.to contain_service('controller').with(
  26. :ensure => true,
  27. :name => platform_params[:ovn_controller_service_name],
  28. :enable => true,
  29. :hasstatus => platform_params[:ovn_controller_service_status],
  30. :pattern => platform_params[:ovn_controller_service_pattern],
  31. )
  32. end
  33. it 'installs controller package' do
  34. is_expected.to contain_package(platform_params[:ovn_controller_package_name]).with(
  35. :ensure => 'present',
  36. :name => platform_params[:ovn_controller_package_name],
  37. :before => 'Service[controller]'
  38. )
  39. end
  40. it 'configures ovsdb' do
  41. is_expected.to contain_vs_config('external_ids:ovn-remote').with(
  42. :value => params[:ovn_remote],
  43. )
  44. is_expected.to contain_vs_config('external_ids:ovn-encap-type').with(
  45. :value => params[:ovn_encap_type],
  46. )
  47. is_expected.to contain_vs_config('external_ids:ovn-encap-ip').with(
  48. :value => params[:ovn_encap_ip],
  49. )
  50. is_expected.to contain_vs_config('external_ids:hostname').with(
  51. :value => 'server1.example.com',
  52. )
  53. is_expected.to contain_vs_config('external_ids:ovn-bridge').with(
  54. :value => params[:ovn_bridge],
  55. )
  56. is_expected.to contain_vs_config('external_ids:ovn-remote-probe-interval').with(
  57. :value => params[:ovn_remote_probe_interval],
  58. )
  59. is_expected.to contain_vs_config('external_ids:ovn-openflow-probe-interval').with(
  60. :value => params[:ovn_openflow_probe_interval],
  61. )
  62. end
  63. it 'configures bridge mappings' do
  64. is_expected.to contain_vs_config('external_ids:ovn-bridge-mappings').with(
  65. :value => 'physnet-1:br-1',
  66. )
  67. is_expected.to contain_ovn__controller__bridge(params[:ovn_bridge_mappings].join(',')).with(
  68. :before => 'Service[controller]',
  69. :require => 'Service[openvswitch]'
  70. )
  71. is_expected.to contain_ovn__controller__port(params[:bridge_interface_mappings].join(',')).with(
  72. :before => 'Service[controller]',
  73. :require => 'Service[openvswitch]'
  74. )
  75. end
  76. end
  77. on_supported_os({
  78. :supported_os => OSDefaults.get_supported_os
  79. }).each do |os,facts|
  80. context "on #{os}" do
  81. let (:facts) do
  82. facts.merge!(OSDefaults.get_facts({
  83. }))
  84. end
  85. case facts[:osfamily]
  86. when 'Debian'
  87. let :platform_params do
  88. {
  89. :ovn_controller_package_name => 'ovn-host',
  90. :ovn_controller_service_name => 'ovn-host',
  91. :ovn_controller_service_status => false,
  92. :ovn_controller_service_pattern => 'ovn-controller'
  93. }
  94. end
  95. it_behaves_like 'ovn controller'
  96. when 'Redhat'
  97. let :platform_params do
  98. {
  99. :ovn_controller_package_name => 'openvswitch-ovn-host',
  100. :ovn_controller_service_name => 'ovn-controller',
  101. :ovn_controller_service_status => true,
  102. :ovn_controller_service_pattern => 'undef'
  103. }
  104. end
  105. it_behaves_like 'ovn controller'
  106. end
  107. end
  108. end
  109. end