Merge "Add networking-fujitsu support to puppet-neutron"

This commit is contained in:
Jenkins 2016-12-09 09:22:57 +00:00 committed by Gerrit Code Review
commit 0b51a73891
5 changed files with 218 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#
# Install the Fujitsu ML2 plugin.
#
# === Parameters
#
# [*package_ensure*]
# (optional) The intended state of the Fujitsu ML2 plugin package
# i.e. any of the possible values of the 'ensure' property for a
# package resource type. Defaults to 'present'
#
class neutron::plugins::ml2::fujitsu (
$package_ensure = 'present'
) {
include ::neutron::deps
ensure_resource('package', 'python-networking-fujitsu',
{
ensure => $package_ensure,
tag => 'openstack',
}
)
}

View File

@ -0,0 +1,60 @@
#
# Configure the Fujitsu neutron ML2 plugin for C-Fabric
#
# === Parameters
#
# [*address*]
# (required) The address of the C-Fabric to telnet to.
# Example: 192.168.0.1
#
# [*username*]
# (optional) The C-Fabric username to use.
# Example: username
#
# [*password*]
# (optional) The C-Fabric password to use.
# Example: password
#
# [*physical_networks*]
# (optional) physical_network names and corresponding vfab ids.
# Example: physnet1:1,physnet2:2
# Defaults to ''
#
# [*share_pprofile*]
# (optional) Whether to share a C-Fabric pprofile among Neutron ports using the
# same VLAN ID.
# Example: true
# Defaults to false
#
# [*pprofile_prefix*]
# (optional) The prefix string for pprofile name.
# Example: neutron-
# Defaults to ''
#
# [*save_config*]
# (optional) Whether to save configuration.
# Example: true
# Defaults to true
class neutron::plugins::ml2::fujitsu::cfab (
$address,
$username,
$password,
$physical_networks = '',
$share_pprofile = false,
$pprofile_prefix = '',
$save_config = true,
)
{
require ::neutron::plugins::ml2
neutron_plugin_ml2 {
'fujitsu_cfab/address' : value => $address;
'fujitsu_cfab/username' : value => $username;
'fujitsu_cfab/password' : value => $password;
'fujitsu_cfab/physical_networks' : value => join(any2array($physical_networks), ',');
'fujitsu_cfab/share_pprofile' : value => $share_pprofile;
'fujitsu_cfab/pprofile_prefix' : value => $pprofile_prefix;
'fujitsu_cfab/save_config' : value => $save_config;
}
}

View File

@ -0,0 +1,3 @@
---
features:
- Add the ability to configure networking-fujitsu ML2 plugin.

View File

@ -0,0 +1,71 @@
#
# Unit tests for neutron::plugins::ml2::fujitsu::cfab class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::fujitsu::cfab' 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
{
:address => '192.168.0.1',
:username => 'admin',
:password => 'admin',
:physical_networks => 'physnet1:1,physnet2:2',
:share_pprofile => 'false',
:pprofile_prefix => 'neutron-',
:save_config => 'true',
}
end
let :params do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron fujitsu ml2 cfab plugin' do
before do
params.merge!(default_params)
end
it do
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/address').with_value(params[:address])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/username').with_value(params[:username])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/password').with_value(params[:password])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/physical_networks').with_value(params[:physical_networks])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/share_pprofile').with_value(params[:share_pprofile])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/pprofile_prefix').with_value(params[:pprofile_prefix])
is_expected.to contain_neutron_plugin_ml2('fujitsu_cfab/save_config').with_value(params[:save_config])
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 cfab plugin'
end
end
end

View File

@ -0,0 +1,60 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::fujitsu' 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
{
:package_ensure => 'present'
}
end
let :params do
{}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron plugin fujitsu ml2' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it 'should have' do
is_expected.to contain_package('python-networking-fujitsu').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
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 plugin fujitsu ml2'
end
end
end