diff --git a/manifests/plugins/ml2/fujitsu/fossw.pp b/manifests/plugins/ml2/fujitsu/fossw.pp new file mode 100644 index 000000000..03dd7e88c --- /dev/null +++ b/manifests/plugins/ml2/fujitsu/fossw.pp @@ -0,0 +1,72 @@ +# +# Configure the Fujitsu neutron ML2 plugin for FOS +# +# === Parameters +# +# [*fossw_ips*] +# (required) The List of IP address of all fos switches. +# Example: 192.168.0.1,192.168.0.2 +# +# NOTE: The following parameters will be shared by all fos switches. +# [*username*] +# (optional) The username of the fos switches. +# Example: username +# +# [*password*] +# (optional) The password of the fos switches. +# Example: password +# +# [*port*] +# (optional) The port number used for SSH connection. +# Example: 22 +# Defaults to 22 +# +# [*timeout*] +# (optional) The timeout os SSH connection. +# Example: 30 +# Defaults to 30 +# +# [*udp_dest_port*] +# (optional) The port number of VXLAN UDP destination on the fos switches. +# All VXLANs on the switches use this UDP port as the UDP destination port in +# the UDP header when encapsulating. +# Example: 4789 +# Defaults to 4789 +# +# [*ovsdb_vlanid_range_min*] +# (optional) The minimum VLAN ID in the range that is used for binding VNI and +# physical port. The range of 78 VLAN IDs (starts from this value) will be +# reserved. Default is 2 (VLAN ID from 2 to 79 will be reserved). +# NOTE: DO NOT include these VLAN IDs into "network_vlan_ranges" in ml2_conf.ini. +# Example: 2 +# Defaults to 2 +# +# [*ovsdb_port*] +# (optional) The port number which OVSDB server on the fos switches listen. +# Example: 6640 +# Defaults to 6640 + +class neutron::plugins::ml2::fujitsu::fossw ( + $fossw_ips, + $username, + $password, + $port = 22, + $timeout = 30, + $udp_dest_port = 4789, + $ovsdb_vlanid_range_min = 2, + $ovsdb_port = 6640, +) +{ + require ::neutron::plugins::ml2 + + neutron_plugin_ml2 { + 'fujitsu_fossw/fossw_ips' : value => join(any2array($fossw_ips), ','); + 'fujitsu_fossw/username' : value => $username; + 'fujitsu_fossw/password' : value => $password; + 'fujitsu_fossw/port' : value => $port; + 'fujitsu_fossw/timeout' : value => $timeout; + 'fujitsu_fossw/udp_dest_port' : value => $udp_dest_port; + 'fujitsu_fossw/ovsdb_vlanid_range_min' : value => $ovsdb_vlanid_range_min; + 'fujitsu_fossw/ovsdb_port' : value => $ovsdb_port; + } +} diff --git a/releasenotes/notes/add-fossw-support-2745199427429f46.yaml b/releasenotes/notes/add-fossw-support-2745199427429f46.yaml new file mode 100644 index 000000000..8cafbb37e --- /dev/null +++ b/releasenotes/notes/add-fossw-support-2745199427429f46.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add the ability to configure fujitsu_fossw neutron ML2 plugin. diff --git a/spec/classes/neutron_plugins_ml2_fujitsu_fossw_spec.rb b/spec/classes/neutron_plugins_ml2_fujitsu_fossw_spec.rb new file mode 100644 index 000000000..82d4849f8 --- /dev/null +++ b/spec/classes/neutron_plugins_ml2_fujitsu_fossw_spec.rb @@ -0,0 +1,73 @@ +# +# 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', + } + class { 'neutron::server': } + class { 'neutron': + rabbit_password => 'passw0rd', + core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin' }" + end + + let :default_params do + { + :fossw_ips => '192.168.0.1,192.168.0.2', + :username => 'admin', + :password => 'admin', + :port => 22, + :timeout => 30, + :udp_dest_port => 4789, + :ovsdb_vlanid_range_min => 2, + :ovsdb_port => 6640, + } + end + + let :params do + {} + end + + let :test_facts do + { :operatingsystem => 'default', + :operatingsystemrelease => 'default', + :concat_basedir => '/', + } + end + + shared_examples_for '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]) + 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]) + 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_configures 'neutron fujitsu ml2 fossw plugin' + end + end +end