Add support to networking-mlnx ml2 drivers

Change-Id: Ife22d7c113c33d6e42a94b9d6c32ed8cb61d6488
Co-authored-by: Hamdy Khader <hamdyk@mellanox.com>
This commit is contained in:
Moshe Levi 2018-02-27 11:46:22 +02:00 committed by Hamdy Khader
parent 0b0a9bb93f
commit beb372b1fe
5 changed files with 212 additions and 0 deletions

@ -0,0 +1,33 @@
#
# Install the Mellanox plugins and generate the config file
# from parameters in the other classes.
#
# === Parameters
#
# [*package_ensure*]
# (optional) The intended state of the networking-mlnx
# package, i.e. any of the possible values of the 'ensure'
# property for a package resource type.
# Defaults to 'present'
#
class neutron::plugins::ml2::mellanox (
$package_ensure = 'present'
) {
include ::neutron::deps
include ::neutron::params
require ::neutron::plugins::ml2
if($::osfamily != 'RedHat') {
# Drivers are only packaged for RedHat at this time
fail("Unsupported osfamily ${::osfamily}")
}
ensure_resource('package', 'python-networking-mlnx',
{
ensure => $package_ensure,
tag => ['openstack', 'neutron-package']
}
)
}

@ -0,0 +1,43 @@
#
# Install the OpenDaylight and generate config file
# from parameters in the other classes.
#
# === Parameters
#
# [*sdn_username*]
# (optional) The Mellanox controller username
# Defaults to $::os_service_default
# Example: 'admin'
#
# [*sdn_password*]
# (optional) The Mellanox controller password
# Defaults to $::os_service_default
# Example: 'admin'
#
# [*sdn_url*]
# (optional) The Mellanox controller neutron URL
# Defaults to $::os_service_default
# Example: 'http://127.0.0.1/neo'
#
# [*sdn_domain*]
# (optional) The Mellanox controller domain
# Defaults to $::os_service_default
# Example: 'cloudx'
#
class neutron::plugins::ml2::mellanox::mlnx_sdn_assist (
$sdn_username = $::os_service_default,
$sdn_password = $::os_service_default,
$sdn_url = $::os_service_default,
$sdn_domain = $::os_service_default,
) {
include ::neutron::deps
require ::neutron::plugins::ml2
neutron_plugin_ml2 {
'sdn/username': value => $sdn_username;
'sdn/password': value => $sdn_password, secret => true;
'sdn/url': value => $sdn_url;
'sdn/domain': value => $sdn_domain;
}
}

@ -0,0 +1,4 @@
---
features:
- |
Adding the ability to configure Mellanox mlnx_sdn_assist mechanism driver for Neutron ml2.

@ -0,0 +1,62 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::mellanox' 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 mellanox 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-mlnx').with(
:ensure => params[:package_ensure],
:tag => ['openstack', 'neutron-package']
)
end
end
begin
context 'on RedHat platforms' do
let :facts do
OSDefaults.get_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
end
it_configures 'neutron plugin mellanox ml2'
end
end
end

@ -0,0 +1,70 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::mellanox::mlnx_sdn_assist' do
let :pre_condition do
"class { '::neutron::keystone::authtoken':
password => 'passw0rd',
}
class { 'neutron::server': }
class { 'neutron':
rabbit_password => 'passw0rd',
core_plugin => 'ml2' }"
end
let :default_params do
{
:sdn_url => '<SERVICE DEFAULT>',
}
end
let :params do
{
:sdn_username => 'user',
:sdn_password => 'password',
}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin mellanox ml2 mlnx_sdn_assist' do
before do
params.merge!(default_params)
end
it 'configures sdn settings' do
is_expected.to contain_neutron_plugin_ml2('sdn/password').with_value(params[:sdn_password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('sdn/username').with_value(params[:sdn_username])
is_expected.to contain_neutron_plugin_ml2('sdn/url').with_value(params[:sdn_url])
end
end
context 'on RedHat platforms' do
let :facts do
OSDefaults.get_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
end
it_configures 'neutron plugin mellanox ml2 mlnx_sdn_assist'
end
context 'on Debian platforms' do
let :facts do
OSDefaults.get_facts.merge(test_facts.merge({
:osfamily => 'Debian',
}))
end
it_configures 'neutron plugin mellanox ml2 mlnx_sdn_assist'
end
end