Fix OVS agent parameters

Currently we have ovsdb_interface parameter which has docs and
validation for of_interface, but they are two different parameters.

Also added tests and updated acceptance spec.

Related-bug: #1599113

Change-Id: I1caa790d4e4aba614e49ba52138f78407bbb69c0
This commit is contained in:
Denis Egorenko 2016-07-19 13:26:57 +03:00
parent 1cd6444358
commit 220a903333
3 changed files with 41 additions and 18 deletions
manifests/agents/ml2
spec

@ -125,11 +125,16 @@
# (optional) The vhost-user socket directory for OVS
# Defaults to $::os_service_default
#
# [*ovsdb_interface*]
# [*of_interface*]
# (optional) OpenFlow interface to use
# Allowed values: ovs-ofctl, native
# Defaults to $::os_service_default
#
# [*ovsdb_interface*]
# (optional) The interface for interacting with the OVSDB
# Allowed values: vsctl, native
# Defaults to $::os_service_default
#
# [*purge_config*]
# (optional) Whether to set only the specified config options
# in the ovs config.
@ -165,6 +170,7 @@ class neutron::agents::ml2::ovs (
$tun_peer_patch_port = $::os_service_default,
$datapath_type = $::os_service_default,
$vhostuser_socket_dir = $::os_service_default,
$of_interface = $::os_service_default,
$ovsdb_interface = $::os_service_default,
$purge_config = false,
# DEPRECATED PARAMETERS
@ -187,8 +193,12 @@ 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')
if ! (is_service_default($of_interface)) and ! ($of_interface =~ /^(ovs-ofctl|native)$/) {
fail('A value of $of_interface is incorrect. The allowed values are ovs-ofctl and native')
}
if ! (is_service_default($ovsdb_interface)) and ! ($ovsdb_interface =~ /^(vsctl|native)$/) {
fail('A value of $ovsdb_interface is incorrect. The allowed values are vsctl and native')
}
if ! is_service_default ($prevent_arp_spoofing) {
@ -240,6 +250,7 @@ class neutron::agents::ml2::ovs (
'ovs/datapath_type': value => $datapath_type;
'ovs/vhostuser_socket_dir': value => $vhostuser_socket_dir;
'ovs/ovsdb_interface': value => $ovsdb_interface;
'ovs/of_interface': value => $of_interface;
}
if $firewall_driver {

@ -74,23 +74,16 @@ describe 'basic neutron' do
enable_tunneling => true,
local_ip => '127.0.0.1',
tunnel_types => ['vxlan'],
# Prior to Newton, the neutron-openvswitch-agent used 'ovs-ofctl' of_interface driver by default.
# In Newton, 'of_interface' defaults to 'native'.
# This mostly eliminates spawning ovs-ofctl and improves performance a little.
# Current openstack-selinux does not allow the Ryu controller to listen on 6633 port.
# So in the meantime, let's use old interface:
of_interface => 'ovs-ofctl',
ovsdb_interface => 'vsctl',
}
class { '::neutron::services::lbaas::haproxy': }
class { '::neutron::services::lbaas::octavia': }
# Prior to Newton, the neutron-openvswitch-agent used 'ovs-ofctl' of_interface driver by default.
# In Newton, 'of_interface' defaults to 'native'.
# This mostly eliminates spawning ovs-ofctl and improves performance a little.
# Current openstack-selinux does not allow the Ryu controller to listen on 6633 port.
# So in the meantime, let's use old interface:
# TODO (degorenko): move both parameters to ::neutron::agents::ml2::ovs class
# https://review.openstack.org/#/c/344155/
neutron_agent_ovs {
'ovs/of_interface': value => 'ovs-ofctl';
}
Neutron_agent_ovs<| title == 'ovs/ovsdb_interface'|>{
value => 'vsctl',
}
EOS

@ -55,6 +55,7 @@ describe 'neutron::agents::ml2::ovs' do
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/of_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])
@ -271,7 +272,7 @@ describe 'neutron::agents::ml2::ovs' 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/
it_raises 'a Puppet::Error', /A value of \$ovsdb_interface is incorrect. The allowed values are vsctl and native/
end
context 'with supported value' do
@ -283,6 +284,24 @@ describe 'neutron::agents::ml2::ovs' do
end
end
end
context 'when supplying of_interface' do
context 'with incorrect value' do
before :each do
params.merge!(:of_interface => 'random')
end
it_raises 'a Puppet::Error', /A value of \$of_interface is incorrect. The allowed values are ovs-ofctl and native/
end
context 'with supported value' do
before :each do
params.merge!(:of_interface => 'native')
end
it 'should configure of_interface for ovs' do
is_expected.to contain_neutron_agent_ovs('ovs/of_interface').with_value('native')
end
end
end
end
context 'on Debian platforms' do