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 # neutron::plugins::ml2::type_driver used by neutron::plugins::ml2
21 define neutron::plugins::ml2::type_driver (
28 if ($name == 'flat') {
30 'ml2_type_flat/flat_networks': value => join($flat_networks, ',');
33 elsif ($name == 'gre') {
34 # tunnel_id_ranges is required in gre
35 if ! $tunnel_id_ranges {
36 fail('when gre is part of type_drivers, tunnel_id_ranges should be given.')
39 validate_tunnel_id_ranges($tunnel_id_ranges)
42 'ml2_type_gre/tunnel_id_ranges': value => join($tunnel_id_ranges, ',');
45 elsif ($name == 'vlan') {
46 # network_vlan_ranges is required in vlan
47 if ! $network_vlan_ranges {
48 fail('when vlan is part of type_drivers, network_vlan_ranges should be given.')
51 validate_network_vlan_ranges($network_vlan_ranges)
54 'ml2_type_vlan/network_vlan_ranges': value => join($network_vlan_ranges, ',');
57 elsif ($name == 'vxlan') {
58 # vni_ranges and vxlan_group are required in vxlan
59 if (! $vni_ranges) or (! $vxlan_group) {
60 fail('when vxlan is part of type_drivers, vni_ranges and vxlan_group should be given.')
62 # test multicast ip address (ipv4 else ipv6):
66 /^(22[4-9]|23[0-9])\.(\d+)\.(\d+)\.(\d+)$/: { }
72 fail("${vxlan_group} is not valid for vxlan_group.")
76 validate_vni_ranges($vni_ranges)
79 'ml2_type_vxlan/vxlan_group': value => $vxlan_group;
80 'ml2_type_vxlan/vni_ranges': value => join($vni_ranges, ',');
83 elsif ($name == 'local') {
84 warning('local type_driver is useful only for single-box, because it provides no connectivity between hosts')
87 # detect an invalid type_drivers value
88 fail('type_driver unknown.')