Adding Cisco VTS ML2 mechanism driver configuration manifest

Implements: blueprint ml2-cisco-vts

Change-Id: Ia26c8c5a568b503be32754bdf124fb9aab070fde
Signed-off-by: Wojciech Dec <wdec@cisco.com>
This commit is contained in:
Wojciech Dec 2017-10-05 17:15:43 +02:00
parent ade98626f7
commit f51323de8e
3 changed files with 158 additions and 0 deletions

View File

@ -0,0 +1,72 @@
# == Define: neutron::plugins::ml2::cisco::vts
#
# Install the Cisco VTS driver and generate the ML2 config file
# from parameters in the other classes.
#
# === Parameters
#
# [*vts_username*]
# (required) The VTS controller username
# Example: 'admin'
#
# [*vts_password*]
# (required) The VTS controller password
# Example: 'admin'
#
# [*vts_url*]
# (required) The VTS controller neutron URL
# Example: 'http://127.0.0.1:8888/api/running/openstack'
#
# [*vts_timeout*]
# (optional) Timeout for connection to vts host REST interface.
# Defaults to $::os_service_default
#
# [*vts_sync_timeout*]
# (optional) Timeout for synchronization to VTS.
# Defaults to $::os_service_default
#
# [*vts_retry_count*]
# (optional) Numer of retries for synchronization with VTS.
# Defaults to $::os_service_default
#
# [*vts_vmmid*]
# (optional) Virtual Machine Manager ID as assigned by VTS
# Defaults to $::os_service_default
#
# [*package_ensure*]
# (optional) The intended state of the cisco-vts-ml2-driver
# package, i.e. any of the possible values of the 'ensure'
# property for a package resource type.
# Defaults to 'present'
#
class neutron::plugins::ml2::cisco::vts (
$vts_username,
$vts_password,
$vts_url,
$vts_vmmid,
$vts_timeout = $::os_service_default,
$vts_sync_timeout = $::os_service_default,
$vts_retry_count = $::os_service_default,
$package_ensure = 'present'
) {
include ::neutron::deps
require ::neutron::plugins::ml2
ensure_resource('package', 'python-cisco-controller',
{
ensure => $package_ensure,
tag => 'openstack',
}
)
neutron_plugin_ml2 {
'ml2_cc/username': value => $vts_username;
'ml2_cc/password': value => $vts_password, secret => true;
'ml2_cc/url': value => $vts_url;
'ml2_cc/timeout': value => $vts_timeout;
'ml2_cc/sync_timeout': value => $vts_sync_timeout;
'ml2_cc/retry_count': value => $vts_retry_count;
'ml2_cc/vmm_id': value => $vts_vmmid;
}
}

View File

@ -0,0 +1,4 @@
---
features:
- |
Adds capability for configuring the Cisco VTS neutron ml2 plugin mechanism driver.

View File

@ -0,0 +1,82 @@
require 'spec_helper'
describe 'neutron::plugins::ml2::cisco::vts' 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
{
:vts_timeout => '<SERVICE DEFAULT>',
:vts_sync_timeout => '<SERVICE DEFAULT>',
:vts_retry_count => '<SERVICE DEFAULT>',
:package_ensure => 'present',
}
end
let :params do
{
:vts_username => 'user',
:vts_password => 'password',
:vts_url => 'http://abc123',
:vts_vmmid => '12345',
}
end
let :test_facts do
{
:operatingsystem => 'default',
:operatingsystemrelease => 'default',
}
end
shared_examples_for 'neutron plugin ml2 cisco vts' do
before do
params.merge!(default_params)
end
it 'should have' do
is_expected.to contain_package('python-cisco-controller').with(
:ensure => params[:package_ensure],
:tag => 'openstack'
)
end
it 'configures ml2_cc cisco_vts settings' do
is_expected.to contain_neutron_plugin_ml2('ml2_cc/password').with_value(params[:vts_password]).with_secret(true)
is_expected.to contain_neutron_plugin_ml2('ml2_cc/username').with_value(params[:vts_username])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/url').with_value(params[:vts_url])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/timeout').with_value(params[:vts_timeout])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/sync_timeout').with_value(params[:vts_sync_timeout])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/retry_count').with_value(params[:vts_retry_count])
is_expected.to contain_neutron_plugin_ml2('ml2_cc/vmm_id').with_value(params[:vts_vmmid])
end
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'RedHat',
:operatingsystemrelease => '7'
}))
end
it_configures 'neutron plugin ml2 cisco vts'
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge(test_facts.merge({
:osfamily => 'Debian',
}))
end
it_configures 'neutron plugin ml2 cisco vts'
end
end