1 # Configure the neutron server to use the OVS plugin.
2 # This configures the plugin for the API server, but does nothing
3 # about configuring the agents that must also run and share a config
4 # file with the OVS plugin if both are on the same machine.
8 class neutron::plugins::ovs (
9 $package_ensure = 'present',
10 $sql_connection = false,
11 $sql_max_retries = false,
12 $sql_idle_timeout = false,
13 $reconnect_interval = false,
14 $tenant_network_type = 'vlan',
15 # NB: don't need tunnel ID range when using VLANs,
16 # *but* you do need the network vlan range regardless of type,
17 # because the list of networks there is still important
18 # even if the ranges aren't specified
19 # if type is vlan or flat, a default of physnet1:1000:2000 is used
20 # otherwise this will not be set by default.
21 $network_vlan_ranges = undef,
22 $tunnel_id_ranges = '1:1000',
23 $vxlan_udp_port = 4789
26 include neutron::params
28 Package['neutron'] -> Package['neutron-plugin-ovs']
29 Package['neutron-plugin-ovs'] -> Neutron_plugin_ovs<||>
30 Neutron_plugin_ovs<||> ~> Service<| title == 'neutron-server' |>
31 Package['neutron-plugin-ovs'] -> Service<| title == 'neutron-server' |>
33 if ! defined(Package['neutron-plugin-ovs']) {
34 package { 'neutron-plugin-ovs':
35 ensure => $package_ensure,
36 name => $::neutron::params::ovs_server_package,
41 warning('sql_connection is deprecated for connection in the neutron::server class')
45 warning('sql_max_retries is deprecated for max_retries in the neutron::server class')
48 if $sql_idle_timeout {
49 warning('sql_idle_timeout is deprecated for idle_timeout in the neutron::server class')
52 if $reconnect_interval {
53 warning('reconnect_interval is deprecated for retry_interval in the neutron::server class')
57 'OVS/tenant_network_type': value => $tenant_network_type;
60 if $tenant_network_type in ['gre', 'vxlan'] {
61 validate_tunnel_id_ranges($tunnel_id_ranges)
63 # this is set by the plugin and the agent - since the plugin node has the agent installed
64 # we rely on it setting it.
65 # TODO(ijw): do something with a virtualised node
66 # 'OVS/enable_tunneling': value => 'True';
67 'OVS/tunnel_id_ranges': value => $tunnel_id_ranges;
68 'OVS/tunnel_type': value => $tenant_network_type;
72 validate_vxlan_udp_port($vxlan_udp_port)
73 neutron_plugin_ovs { 'OVS/vxlan_udp_port': value => $vxlan_udp_port; }
75 if ! $network_vlan_ranges {
76 # If the user hasn't specified vlan_ranges, fail for the modes where
77 # it is required, otherwise keep it absent
78 if $tenant_network_type in ['vlan', 'flat'] {
79 fail('When using the vlan network type, network_vlan_ranges is required')
81 neutron_plugin_ovs { 'OVS/network_vlan_ranges': ensure => absent }
84 # This might be set by the user for the gre or vxlan case where
85 # provider networks are in use
86 if !is_array($network_vlan_ranges) {
87 $arr_network_vlan_ranges = strip(split($network_vlan_ranges, ','))
89 $arr_network_vlan_ranges = $network_vlan_ranges
92 validate_network_vlan_ranges($arr_network_vlan_ranges)
94 'OVS/network_vlan_ranges': value => join($arr_network_vlan_ranges, ',');
98 # In RH, this link is used to start Neutron process but in Debian, it's used only
99 # to manage database synchronization.
100 file {'/etc/neutron/plugin.ini':
102 target => '/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini',
103 require => Package['neutron-plugin-ovs']