Changes OpenDaylight OVS 'provider_mappings' to allow an array type

This provides better consistency with ml2 ovs 'bridge_mappings' which is
also an array.  The two variables are essentially the same format.

Change-Id: I94b1b1681529c58c9e52b4a23c0facaa2e57f792
Signed-off-by: Tim Rozet <trozet@redhat.com>
This commit is contained in:
Tim Rozet
2016-10-05 12:29:44 -04:00
parent 15ecd749a0
commit f0d3e84a9e
3 changed files with 19 additions and 14 deletions

View File

@@ -24,9 +24,10 @@
# Defaults to 'tcp:127.0.0.1:6640' # Defaults to 'tcp:127.0.0.1:6640'
# #
# [*provider_mappings*] # [*provider_mappings*]
# (optional) bridge mappings required if using VLAN # (optional) List of <physical_network>:<nic/bridge>
# tenant type. Example: provider_mappings=br-ex:eth0 # Required for VLAN provider networks.
# Defaults to false # Required for Flat provider networks when using new NetVirt
# Defaults to empty list
# #
# [*retry_interval*] # [*retry_interval*]
# (optional) The time (in seconds) to wait between ODL availability checks # (optional) The time (in seconds) to wait between ODL availability checks
@@ -38,11 +39,11 @@
# #
class neutron::plugins::ovs::opendaylight ( class neutron::plugins::ovs::opendaylight (
$tunnel_ip, $tunnel_ip,
$odl_username = 'admin', $odl_username = 'admin',
$odl_password = 'admin', $odl_password = 'admin',
$odl_check_url = 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1', $odl_check_url = 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1',
$odl_ovsdb_iface = 'tcp:127.0.0.1:6640', $odl_ovsdb_iface = 'tcp:127.0.0.1:6640',
$provider_mappings = false, $provider_mappings = [],
$retry_interval = 60, $retry_interval = 60,
$retry_count = 20, $retry_count = 20,
) { ) {
@@ -71,11 +72,12 @@ class neutron::plugins::ovs::opendaylight (
path => '/usr/sbin:/usr/bin:/sbin:/bin', path => '/usr/sbin:/usr/bin:/sbin:/bin',
} }
# set mappings for VLAN # set mappings for VLAN or Flat provider networks
if $provider_mappings { if $provider_mappings and ! empty($provider_mappings) {
$pr_map_str = join(any2array($provider_mappings), ',')
exec { 'Set provider_mappings Other Option': exec { 'Set provider_mappings Other Option':
command => "ovs-vsctl set Open_vSwitch $(ovs-vsctl get Open_vSwitch . _uuid) other_config:provider_mappings=${provider_mappings}", command => "ovs-vsctl set Open_vSwitch $(ovs-vsctl get Open_vSwitch . _uuid) other_config:provider_mappings=${pr_map_str}",
unless => "ovs-vsctl list Open_vSwitch | grep 'provider_mappings' | grep ${provider_mappings}", unless => "ovs-vsctl list Open_vSwitch | grep 'provider_mappings' | grep ${pr_map_str}",
path => '/usr/sbin:/usr/bin:/sbin:/bin', path => '/usr/sbin:/usr/bin:/sbin:/bin',
} }
} }

View File

@@ -0,0 +1,3 @@
---
upgrade:
- Opendaylight OVS provider_mappings argument now accepts an array type.

View File

@@ -15,7 +15,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
:odl_password => 'admin', :odl_password => 'admin',
:odl_check_url => 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1', :odl_check_url => 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1',
:odl_ovsdb_iface => 'tcp:127.0.0.1:6640', :odl_ovsdb_iface => 'tcp:127.0.0.1:6640',
:provider_mappings => false, :provider_mappings => [],
:retry_interval => 60, :retry_interval => 60,
:retry_count => 20, :retry_count => 20,
} }
@@ -42,7 +42,7 @@ describe 'neutron::plugins::ovs::opendaylight' do
context 'with provider mappings' do context 'with provider mappings' do
before do before do
params.merge!({ :provider_mappings => true }) params.merge!({ :provider_mappings => ['default:br-ex'] })
end end
it_configures 'with provider mappings' it_configures 'with provider mappings'
end end