Support midonet type driver for ML2

Midonet now works under ML2 and provides the midonet and uplink
network type

Change-Id: Id6948c98ffe5b0ff4a18ec44637480a6b68a00a6
This commit is contained in:
Sam Morrison 2016-02-10 15:57:35 +11:00
parent b4d79aae7f
commit c9f487fef3
3 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# == Class: neutron::plugins::ml2::midonet
#
# Configure the Mech Driver for midonet neutron plugin
#
# === Parameters:
#
# [*midonet_uri*]
# (required) MidoNet API server URI.
# Usually of the form 'http://<midonet-api-hostname>:8080/midonet-api'
#
# [*username*]
# (required) MidoNet admin username.
#
# [*password*]
# (required) MidoNet admin password.
#
# [*project_id*]
# (optional) Name of the project that MidoNet admin user belongs to.
# Defaults to 'service'
#
class neutron::plugins::ml2::midonet (
$midonet_uri,
$username,
$password,
$project_id = 'services',
) {
neutron_plugin_ml2 {
'MIDONET/midonet_uri' : value => $midonet_uri;
'MIDONET/username' : value => $username;
'MIDONET/password' : value => $password, secret => true;
'MIDONET/project_id' : value => $project_id;
}
}

View File

@ -107,6 +107,9 @@ define neutron::plugins::ml2::type_driver (
elsif ($name == 'nexus_vxlan') {
# Nexus_vxlan type driver has its own class separate from this one
}
elsif ($name == 'midonet') or ($name == 'uplink') {
# midonet type driver has its own class separate from this one
}
else {
# detect an invalid type_drivers value
fail('type_driver unknown.')

View File

@ -0,0 +1,69 @@
#
# Unit tests for neutron::plugins::ml2::midonet class
#
require 'spec_helper'
describe 'neutron::plugins::ml2::midonet' do
let :pre_condition do
"class { 'neutron::server': auth_password => 'password'}
class { 'neutron':
rabbit_password => 'passw0rd',
core_plugin => 'neutron.plugins.ml2.plugin.Ml2Plugin' }"
end
let :default_params do
{
:midonet_uri => 'http://localhost:8080/midonet-api',
:username => 'admin',
:password => 'passw0rd',
:project_id => 'admin',
}
end
let :params do
{}
end
let :test_facts do
{ :operatingsystem => 'default',
:operatingsystemrelease => 'default',
:concat_basedir => '/',
}
end
shared_examples_for 'neutron ml2 midonet plugin' do
before do
params.merge!(default_params)
end
it { is_expected.to contain_class('neutron::params') }
it do
is_expected.to contain_neutron_plugin_ml2('MIDONET/midonet_uri').with_value(params[:midonet_uri])
is_expected.to contain_neutron_plugin_ml2('MIDONET/username').with_value(params[:username])
is_expected.to contain_neutron_plugin_ml2('MIDONET/password').with_value(params[:password])
is_expected.to contain_neutron_plugin_ml2('MIDONET/project_id').with_value(params[:project_id])
end
end
begin
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
end
let :platform_params do
{ :midonet_ml2_config_file => '/etc/neutron/conf.d/neutron-server/ml2_mech_midonet.conf' }
end
it_configures 'neutron ml2 midonet plugin'
end
end
end