Addition of Nuage as mechanism driver for ML2
Adding support for Nuage to be included as mechanism driver where ML2 is the neutron core plugin. All the parameters required to configure Nuage plugin are included in the puppet file. Change-Id: I96b34f34e4255d511ca570524739b8ade53a7bb3
This commit is contained in:
parent
891dd37265
commit
86906fb51f
91
manifests/plugins/ml2/nuage.pp
Normal file
91
manifests/plugins/ml2/nuage.pp
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#
|
||||||
|
# Configure the Nuage plugin for neutron.
|
||||||
|
#
|
||||||
|
# === Parameters
|
||||||
|
#
|
||||||
|
# [*nuage_net_partition_name*]
|
||||||
|
# (required) The net partition under which the VMs will be
|
||||||
|
# seen in the VSD
|
||||||
|
#
|
||||||
|
# [*nuage_vsd_ip*]
|
||||||
|
# (required) IP address of the Virtual Services Directory
|
||||||
|
#
|
||||||
|
# [*nuage_vsd_username*]
|
||||||
|
# (required) Username to be used to log into VSD
|
||||||
|
#
|
||||||
|
# [*nuage_vsd_password*]
|
||||||
|
# (required) Password to be used to log into VSD
|
||||||
|
#
|
||||||
|
# [*nuage_vsd_organization*]
|
||||||
|
# (required) Parameter required to log into VSD
|
||||||
|
#
|
||||||
|
# [*nuage_base_uri_version*]
|
||||||
|
# (required) URI version to be used based on the VSD release
|
||||||
|
# For example v3_0
|
||||||
|
#
|
||||||
|
# [*nuage_cms_id*]
|
||||||
|
# (required) CMS ID generated by the VSD
|
||||||
|
#
|
||||||
|
# [*nuage_auth_resource*]
|
||||||
|
# (optional) The auth resource value to be use to connect
|
||||||
|
# to VSD. The default is /me
|
||||||
|
#
|
||||||
|
# [*nuage_server_ssl*]
|
||||||
|
# (optional) Flag to determine whether to use ssl connection
|
||||||
|
# to connect to VSD. The default is True
|
||||||
|
#
|
||||||
|
# [*purge_config*]
|
||||||
|
# (optional) Whether to set only the specified config options
|
||||||
|
# in the nuage config.
|
||||||
|
# Defaults to false.
|
||||||
|
#
|
||||||
|
class neutron::plugins::ml2::nuage (
|
||||||
|
$nuage_net_partition_name,
|
||||||
|
$nuage_vsd_ip,
|
||||||
|
$nuage_vsd_username,
|
||||||
|
$nuage_vsd_password,
|
||||||
|
$nuage_vsd_organization,
|
||||||
|
$nuage_base_uri_version,
|
||||||
|
$nuage_cms_id,
|
||||||
|
$nuage_auth_resource = '/me',
|
||||||
|
$nuage_server_ssl = true,
|
||||||
|
$purge_config = false,
|
||||||
|
) {
|
||||||
|
|
||||||
|
include ::neutron::deps
|
||||||
|
include ::neutron::params
|
||||||
|
|
||||||
|
file { '/etc/neutron/plugins/nuage':
|
||||||
|
ensure => directory,
|
||||||
|
tag => 'neutron-config-file',
|
||||||
|
}
|
||||||
|
|
||||||
|
file { '/etc/neutron/plugins/nuage/plugin.ini':
|
||||||
|
ensure => file,
|
||||||
|
owner => 'root',
|
||||||
|
group => 'neutron',
|
||||||
|
require => File['/etc/neutron/plugins/nuage'],
|
||||||
|
mode => '0640',
|
||||||
|
tag => 'neutron-config-file',
|
||||||
|
}
|
||||||
|
|
||||||
|
resources { 'neutron_plugin_nuage':
|
||||||
|
purge => $purge_config,
|
||||||
|
}
|
||||||
|
|
||||||
|
$nuage_base_uri_base = '/nuage/api'
|
||||||
|
neutron_plugin_nuage {
|
||||||
|
'RESTPROXY/default_net_partition_name': value => $nuage_net_partition_name;
|
||||||
|
'RESTPROXY/server': value => $nuage_vsd_ip;
|
||||||
|
'RESTPROXY/serverauth': value => "${nuage_vsd_username}:${nuage_vsd_password}";
|
||||||
|
'RESTPROXY/organization': value => $nuage_vsd_organization;
|
||||||
|
'RESTPROXY/auth_resource': value => $nuage_auth_resource;
|
||||||
|
'RESTPROXY/serverssl': value => $nuage_server_ssl;
|
||||||
|
'RESTPROXY/base_uri': value => "${nuage_base_uri_base}/${nuage_base_uri_version}";
|
||||||
|
'RESTPROXY/cms_id': value => $nuage_cms_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
if $::neutron::core_plugin != 'ml2' or !('nuage' in $::neutron::plugins::ml2::mechanism_drivers) {
|
||||||
|
fail('Nuage should be the mechanism driver in neutron.conf')
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Additional support for Nuage is added in neutron, as a result of which
|
||||||
|
Nuage can be plugged into neutron as ML2 mechanism driver. This feature
|
||||||
|
is in addition to the option of usign Nuage as the core plugin. This
|
||||||
|
change adds neutron::plugins::ml2::nuage
|
96
spec/classes/neutron_plugins_ml2_nuage_spec.rb
Normal file
96
spec/classes/neutron_plugins_ml2_nuage_spec.rb
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'neutron::plugins::ml2::nuage' do
|
||||||
|
|
||||||
|
let :pre_condition do
|
||||||
|
"class { '::neutron':
|
||||||
|
rabbit_password => 'passw0rd',
|
||||||
|
core_plugin => 'ml2' }
|
||||||
|
class { '::neutron::keystone::authtoken':
|
||||||
|
password => 'passw0rd',
|
||||||
|
}
|
||||||
|
class { 'neutron::server': }
|
||||||
|
class { '::neutron::plugins::ml2':
|
||||||
|
mechanism_drivers => ['nuage'] }"
|
||||||
|
end
|
||||||
|
|
||||||
|
let :test_facts do
|
||||||
|
{ :operatingsystem => 'default',
|
||||||
|
:operatingsystemrelease => 'default'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:nuage_vsd_ip => %w(192.168.33.3),
|
||||||
|
:nuage_vsd_username => 'test',
|
||||||
|
:nuage_vsd_password => 'test',
|
||||||
|
:nuage_vsd_organization => 'vsd',
|
||||||
|
:nuage_net_partition_name => 'test',
|
||||||
|
:nuage_base_uri_version => 'v3.0',
|
||||||
|
:nuage_cms_id => '7488fae2-7e51-11e5-8bcf-feff819cdc9f',
|
||||||
|
:purge_config => false,}
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'neutron plugin ml2 nuage' do
|
||||||
|
|
||||||
|
it { is_expected.to contain_class('neutron::params') }
|
||||||
|
|
||||||
|
it 'configures neutron.conf' do
|
||||||
|
is_expected.to contain_neutron_config('DEFAULT/core_plugin').with_value('ml2')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'passes purge to resource' do
|
||||||
|
is_expected.to contain_resources('neutron_plugin_nuage').with({
|
||||||
|
:purge => false
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should have a nuage plugin ini file' do
|
||||||
|
is_expected.to contain_file('/etc/neutron/plugins/nuage/plugin.ini').with(
|
||||||
|
:ensure => 'file',
|
||||||
|
:owner => 'root',
|
||||||
|
:group => 'neutron',
|
||||||
|
:mode => '0640'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should configure plugin.ini' do
|
||||||
|
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/default_net_partition_name').with_value(params[:nuage_net_partition_name])
|
||||||
|
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/server').with_value(params[:nuage_vsd_ip])
|
||||||
|
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/organization').with_value(params[:nuage_vsd_organization])
|
||||||
|
is_expected.to contain_neutron_plugin_nuage('RESTPROXY/cms_id').with_value(params[:nuage_cms_id])
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'configure ml2 nuage with wrong core_plugin configuration' do
|
||||||
|
let :pre_condition do
|
||||||
|
"class { 'neutron':
|
||||||
|
rabbit_password => 'passw0rd',
|
||||||
|
core_plugin => 'foo' }"
|
||||||
|
end
|
||||||
|
|
||||||
|
it_raises 'a Puppet::Error', /Nuage should be the mechanism driver in neutron.conf/
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'configure ml2 nuage with wrong mechanism_driver configuration' do
|
||||||
|
let :pre_condition do
|
||||||
|
"class { '::neutron::plugins::ml2':
|
||||||
|
mechanism_drivers => ['bar'] }"
|
||||||
|
end
|
||||||
|
|
||||||
|
it_raises 'a Puppet::Error', /Nuage should be the mechanism driver in neutron.conf/
|
||||||
|
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 ml2 nuage'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user