2 # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
4 # Author: Emilien Macchi <emilien.macchi@enovance.com>
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
18 # Configure the neutron server to use the ML2 plugin.
19 # This configures the plugin for the API server, but does nothing
20 # about configuring the agents that must also run and share a config
21 # file with the OVS plugin if both are on the same machine.
26 # (optional) List of network type driver entrypoints to be loaded
27 # from the neutron.ml2.type_drivers namespace.
28 # Could be an array that can have these elements:
29 # local, flat, vlan, gre, vxlan
30 # Defaults to ['local', 'flat', 'vlan', 'gre', 'vxlan'].
32 # [*tenant_network_types*]
33 # (optional) Ordered list of network_types to allocate as tenant networks.
34 # The value 'local' is only useful for single-box testing
35 # but provides no connectivity between hosts.
36 # Should be an array that can have these elements:
37 # local, flat, vlan, gre, vxlan
38 # Defaults to ['local', 'flat', 'vlan', 'gre', 'vxlan'].
40 # [*mechanism_drivers*]
41 # (optional) An ordered list of networking mechanism driver
42 # entrypoints to be loaded from the neutron.ml2.mechanism_drivers namespace.
43 # Should be an array that can have these elements:
44 # logger, test, linuxbridge, openvswitch, hyperv, ncs, arista, cisco_nexus,
45 # l2population, sriovnicswitch
46 # Default to ['openvswitch', 'linuxbridge'].
49 # (optional) List of physical_network names with which flat networks
50 # can be created. Use * to allow flat networks with arbitrary
51 # physical_network names.
55 # [*network_vlan_ranges*]
56 # (optional) List of <physical_network>:<vlan_min>:<vlan_max> or
57 # <physical_network> specifying physical_network names
58 # usable for VLAN provider and tenant networks, as
59 # well as ranges of VLAN tags on each available for
60 # allocation to tenant networks.
61 # Should be an array with vlan_min = 1 & vlan_max = 4094 (IEEE 802.1Q)
64 # [*tunnel_id_ranges*]
65 # (optional) Comma-separated list of <tun_min>:<tun_max> tuples
66 # enumerating ranges of GRE tunnel IDs that are
67 # available for tenant network allocation
68 # Should be an array with tun_max +1 - tun_min > 1000000
72 # (optional) Multicast group for VXLAN.
73 # Multicast group for VXLAN. If unset, disables VXLAN enable sending allocate
74 # broadcast traffic to this multicast group. When left unconfigured, will
75 # disable multicast VXLAN mode
76 # Should be an Multicast IP (v4 or v6) address.
80 # (optional) Comma-separated list of <vni_min>:<vni_max> tuples
81 # enumerating ranges of VXLAN VNI IDs that are
82 # available for tenant network allocation.
83 # Min value is 0 and Max value is 16777215.
86 # [*enable_security_group*]
87 # (optional) Controls if neutron security group is enabled or not.
88 # It should be false when you use nova security group.
91 # [*supported_pci_vendor_devs*]
92 # (optional) Supported PCI vendor devices, defined by
93 # vendor_id:product_id according to the PCI ID
94 # Repository. Should be an array of devices.
95 # Defaults to ['15b3:1004', '8086:10ca'] (Intel & Mellanox SR-IOV capable NICs)
97 # [*sriov_agent_required*]
98 # (optional) SRIOV neutron agent is required for port binding.
99 # Only set to true if SRIOV network adapters support VF link state setting
100 # and if admin state management is desired.
104 class neutron::plugins::ml2 (
105 $type_drivers = ['local', 'flat', 'vlan', 'gre', 'vxlan'],
106 $tenant_network_types = ['local', 'flat', 'vlan', 'gre', 'vxlan'],
107 $mechanism_drivers = ['openvswitch', 'linuxbridge'],
108 $flat_networks = ['*'],
109 $network_vlan_ranges = ['physnet1:1000:2999'],
110 $tunnel_id_ranges = ['20:100'],
111 $vxlan_group = '224.0.0.1',
112 $vni_ranges = ['10:100'],
113 $enable_security_group = true,
114 $package_ensure = 'present',
115 $supported_pci_vendor_devs = ['15b3:1004', '8086:10ca'],
116 $sriov_agent_required = false,
119 include neutron::params
121 Neutron_plugin_ml2<||> ~> Service<| title == 'neutron-server' |>
123 validate_array($mechanism_drivers)
124 if ! $mechanism_drivers {
125 warning('Without networking mechanism driver, ml2 will not communicate with L2 agents')
128 if $::operatingsystem == 'Ubuntu' {
129 file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG':
130 path => '/etc/default/neutron-server',
131 match => '^NEUTRON_PLUGIN_CONFIG=(.*)$',
132 line => 'NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugin.ini',
133 require => File['/etc/neutron/plugin.ini'],
135 Package<| title == 'neutron-server' |>
136 -> File_line['/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG']
137 ~> Service<| title == 'neutron-server' |>
140 # In RH, the link is used to start Neutron process but in Debian, it's used only
141 # to manage database synchronization.
142 file {'/etc/neutron/plugin.ini':
144 target => '/etc/neutron/plugins/ml2/ml2_conf.ini'
147 # Some platforms do not have a dedicated ml2 plugin package
148 if $::neutron::params::ml2_server_package {
149 package { 'neutron-plugin-ml2':
150 ensure => $package_ensure,
151 name => $::neutron::params::ml2_server_package,
153 Package['neutron-plugin-ml2'] -> Neutron_plugin_ml2<||>
154 Package['neutron-plugin-ml2'] -> File['/etc/neutron/plugin.ini']
156 Package <| title == 'neutron-server' |> -> Neutron_plugin_ml2<||>
157 Package['neutron'] -> File['/etc/neutron/plugin.ini']
160 neutron::plugins::ml2::type_driver { $type_drivers:
161 flat_networks => $flat_networks,
162 tunnel_id_ranges => $tunnel_id_ranges,
163 network_vlan_ranges => $network_vlan_ranges,
164 vni_ranges => $vni_ranges,
165 vxlan_group => $vxlan_group,
168 neutron::plugins::ml2::mech_driver { $mechanism_drivers:
169 supported_pci_vendor_devs => $supported_pci_vendor_devs,
170 sriov_agent_required => $sriov_agent_required,
174 'ml2/type_drivers': value => join($type_drivers, ',');
175 'ml2/tenant_network_types': value => join($tenant_network_types, ',');
176 'ml2/mechanism_drivers': value => join($mechanism_drivers, ',');
177 'securitygroup/enable_security_group': value => $enable_security_group;
180 Neutron_plugin_ml2<||> ~> Exec<| title == 'neutron-db-sync' |>