Add support for ovsdb_interface option

ovsdb_interface option allows to change a mechanism of performing basic
vSwitch CRUD operations. The supported values are 'ovs-ofctl' (Open vSwitch
CLI commands) and 'native' (direct OVSDB protocol commands)

Change-Id: Ib1aabcbaa21fc78327435356bced8643b3bc02b2
This commit is contained in:
Sergey Kolekonov 2016-03-16 21:23:38 +03:00
parent 35ace1c6c6
commit 2b00aeacca
2 changed files with 30 additions and 0 deletions

View File

@ -129,6 +129,11 @@
# (optional) The vhost-user socket directory for OVS
# Defaults to $::os_service_default
#
# [*ovsdb_interface*]
# (optional) OpenFlow interface to use
# Allowed values: ovs-ofctl, native
# Defaults to $::os_service_default
#
class neutron::agents::ml2::ovs (
$package_ensure = 'present',
$enabled = true,
@ -154,6 +159,7 @@ class neutron::agents::ml2::ovs (
$tun_peer_patch_port = $::os_service_default,
$datapath_type = $::os_service_default,
$vhostuser_socket_dir = $::os_service_default,
$ovsdb_interface = $::os_service_default,
) {
include ::neutron::params
@ -171,6 +177,10 @@ class neutron::agents::ml2::ovs (
}
}
if ! (is_service_default($ovsdb_interface)) and ! ($ovsdb_interface =~ /^(ovs-ofctl|native)$/) {
fail('A value of $ovsdb_interface is incorrect. The allowed values are ovs-ofctl and native')
}
Neutron_agent_ovs<||> ~> Service['neutron-ovs-agent-service']
if ($bridge_mappings != []) {
@ -213,6 +223,7 @@ class neutron::agents::ml2::ovs (
'ovs/integration_bridge': value => $integration_bridge;
'ovs/datapath_type': value => $datapath_type;
'ovs/vhostuser_socket_dir': value => $vhostuser_socket_dir;
'ovs/ovsdb_interface': value => $ovsdb_interface;
}
if $firewall_driver {

View File

@ -47,6 +47,7 @@ describe 'neutron::agents::ml2::ovs' do
is_expected.to contain_neutron_agent_ovs('agent/extensions').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/datapath_type').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/vhostuser_socket_dir').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/ovsdb_interface').with_value(['<SERVICE DEFAULT>'])
is_expected.to contain_neutron_agent_ovs('ovs/integration_bridge').with_value(p[:integration_bridge])
is_expected.to contain_neutron_agent_ovs('securitygroup/firewall_driver').\
with_value(p[:firewall_driver])
@ -257,6 +258,24 @@ describe 'neutron::agents::ml2::ovs' do
end
end
end
context 'when supplying ovsdb_interface' do
context 'with incorrect value' do
before :each do
params.merge!(:ovsdb_interface => 'random')
end
it_raises 'a Puppet::Error', /A value of \$ovsdb_interface is incorrect. The allowed values are ovs-ofctl and native/
end
context 'with supported value' do
before :each do
params.merge!(:ovsdb_interface => 'native')
end
it 'should configure ovsdb_interface for ovs' do
is_expected.to contain_neutron_agent_ovs('ovs/ovsdb_interface').with_value('native')
end
end
end
end
context 'on Debian platforms' do