Refactor Bagpipe driver support for including ML2 plugin configuration
Bagpipe driver requires two configurations for a BGPVPN scenario. One is related to the bagpipe-bgp service which reads bgp.conf and the other related to the ml2 plugin extension. Change-Id: Ic975ec1d6b2bf6e6bd28b47ba9dd2a3ae629d149 Signed-off-by: Ricardo Noriega <rnoriega@redhat.com>
This commit is contained in:
parent
166f65f5ad
commit
5393b9beb8
|
@ -22,7 +22,7 @@ Puppet::Type.newtype(:neutron_bgpvpn_bagpipe_config) do
|
|||
end
|
||||
|
||||
autorequire(:package) do
|
||||
['python-networking-bagpipe']
|
||||
['openstack-bagpipe-bgp']
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -109,10 +109,10 @@ class neutron::agents::bagpipe (
|
|||
'dataplane_driver_ipvpn/mpls_interface': value => $mpls_interface;
|
||||
}
|
||||
|
||||
if $::neutron::params::bgpvpn_bagpipe_package {
|
||||
package { 'python-networking-bagpipe':
|
||||
if $::neutron::params::bagpipe_bgp_package {
|
||||
package { 'openstack-bagpipe-bgp':
|
||||
ensure => $package_ensure,
|
||||
name => $::neutron::params::bgpvpn_bagpipe_package,
|
||||
name => $::neutron::params::bagpipe_bgp_package,
|
||||
tag => ['openstack', 'neutron-package'],
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class neutron::params {
|
|||
$vpnaas_agent_service = 'neutron-vpn-agent'
|
||||
$l3_agent_service = 'neutron-l3-agent'
|
||||
$metadata_agent_service = 'neutron-metadata-agent'
|
||||
$bagpipe_bgp_package = 'openstack-bagpipe-bgp'
|
||||
$bgpvpn_bagpipe_package = 'python-networking-bagpipe'
|
||||
$bgpvpn_bagpipe_service = 'bagpipe-bgp'
|
||||
$bgpvpn_plugin_package = 'python-networking-bgpvpn'
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
#
|
||||
# Copyright (C) 2017 Red Hat Inc.
|
||||
#
|
||||
# Author: Ricardo Noriega <rnoriega@redhat.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# == Class: neutron::plugins::ml2::bagpipe
|
||||
#
|
||||
# Installs and configures the Bagpipe extensions for BGPVPN service
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*bagpipe_bgp_port*]
|
||||
# BGP component API port
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*mpls_bridge*]
|
||||
# OVS bridge to use
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) The state of the package
|
||||
# Defaults to present
|
||||
#
|
||||
class neutron::plugins::ml2::bagpipe (
|
||||
$bagpipe_bgp_port = $::os_service_default,
|
||||
$mpls_bridge = $::os_service_default,
|
||||
$package_ensure = 'present',
|
||||
) {
|
||||
|
||||
include ::neutron::deps
|
||||
include ::neutron::params
|
||||
require ::neutron::plugins::ml2
|
||||
|
||||
neutron_plugin_ml2 {
|
||||
'bagpipe/bagpipe_bgp_port': value => $bagpipe_bgp_port;
|
||||
'bagpipe/mpls_bridge': value => $mpls_bridge;
|
||||
}
|
||||
|
||||
if $::neutron::params::bgpvpn_bagpipe_package {
|
||||
package { 'python-networking-bagpipe':
|
||||
ensure => $package_ensure,
|
||||
name => $::neutron::params::bgpvpn_bagpipe_package,
|
||||
tag => 'openstack',
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ features:
|
|||
- Add new type for BGPVPN Service config
|
||||
- Add new provider for BGPVPN Service config
|
||||
- Add Bagpipe agent as reference driver
|
||||
- Add Bagpipe ML2 plugin config
|
||||
- Add new type for Bagpipe driver
|
||||
- Add new provider for Bagpipe driver
|
||||
- Add spec and unit tests
|
||||
|
|
|
@ -56,9 +56,9 @@ describe 'neutron::agents::bagpipe' do
|
|||
end
|
||||
|
||||
it 'installs bgpvpn bagpipe package' do
|
||||
is_expected.to contain_package('python-networking-bagpipe').with(
|
||||
is_expected.to contain_package('openstack-bagpipe-bgp').with(
|
||||
:ensure => p[:package_ensure],
|
||||
:name => platform_params[:bgpvpn_bagpipe_package],
|
||||
:name => platform_params[:bagpipe_bgp_package],
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -104,9 +104,9 @@ describe 'neutron::agents::bagpipe' do
|
|||
let (:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'RedHat'
|
||||
{ :bgpvpn_bagpipe_package => 'python-networking-bagpipe' }
|
||||
{ :bagpipe_bgp_package => 'openstack-bagpipe-bgp' }
|
||||
when 'Debian'
|
||||
{ :bgpvpn_bagpipe_package => 'python-networking-bagpipe' }
|
||||
{ :bagpipe_bgp_package => 'openstack-bagpipe-bgp' }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'neutron::plugins::ml2::bagpipe' do
|
||||
|
||||
let :default_params do
|
||||
{
|
||||
:bagpipe_bgp_port => '<SERVICE DEFAULT>',
|
||||
:mpls_bridge => '<SERVICE DEFAULT>',
|
||||
:package_ensure => 'present',
|
||||
}
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
}
|
||||
end
|
||||
|
||||
let :test_facts do
|
||||
{
|
||||
:operatingsystem => 'default',
|
||||
:operatingsystemrelease => 'default',
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
shared_examples_for 'neutron plugin bagpipe ml2' do
|
||||
before do
|
||||
params.merge!(default_params)
|
||||
end
|
||||
|
||||
it 'should have' do
|
||||
is_expected.to contain_package('python-networking-bagpipe').with(
|
||||
:ensure => params[:package_ensure],
|
||||
:tag => 'openstack'
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures bagpipe settings' do
|
||||
is_expected.to contain_neutron_plugin_ml2('bagpipe/bagpipe_bgp_port').with_value(params[:bagpipe_bgp_port])
|
||||
is_expected.to contain_neutron_plugin_ml2('bagpipe/mpls_bridge').with_value(params[:mpls_bridge])
|
||||
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
|
||||
|
||||
let (:platform_params) do
|
||||
case facts[:osfamily]
|
||||
when 'RedHat'
|
||||
{ :bagpipe_package_name => 'python-networking-bagpipe' }
|
||||
when 'Debian'
|
||||
{ :bagpipe_package_name => 'python-networking-bagpipe' }
|
||||
end
|
||||
end
|
||||
it_configures 'neutron plugin bagpipe ml2'
|
||||
end
|
||||
end
|
||||
end
|
|
@ -9,7 +9,7 @@ describe 'Puppet::Type.type(:neutron_bgpvpn_bagpipe_config)' do
|
|||
|
||||
it 'should autorequire the package that install the file' do
|
||||
catalog = Puppet::Resource::Catalog.new
|
||||
package = Puppet::Type.type(:package).new(:name => 'python-networking-bagpipe')
|
||||
package = Puppet::Type.type(:package).new(:name => 'openstack-bagpipe-bgp')
|
||||
catalog.add_resource package, @neutron_bgpvpn_bagpipe_config
|
||||
dependency = @neutron_bgpvpn_bagpipe_config.autorequire
|
||||
expect(dependency.size).to eq(1)
|
||||
|
|
Loading…
Reference in New Issue