1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2018 Mirantis Inc., Enea AB and others.
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Thu, 6 Dec 2018 18:25:42 +0100
11 Subject: [PATCH] Bring in basic VPP support
16 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
18 neutron/agents/_vpp.sls | 25 ++++++++++++++++
19 neutron/compute.sls | 2 ++
20 neutron/files/queens/_ml2_conf.vpp.ini | 41 ++++++++++++++++++++++++++
21 neutron/files/queens/ml2_conf.ini | 5 ++++
22 neutron/gateway.sls | 2 ++
23 neutron/map.jinja | 16 ++++++++++
24 6 files changed, 91 insertions(+)
25 create mode 100644 neutron/agents/_vpp.sls
26 create mode 100644 neutron/files/queens/_ml2_conf.vpp.ini
28 diff --git a/neutron/agents/_vpp.sls b/neutron/agents/_vpp.sls
30 index 0000000..c1845d0
32 +++ b/neutron/agents/_vpp.sls
34 +{%- if pillar.neutron.gateway is defined %}
35 +{%- from "neutron/map.jinja" import gateway as neutron with context %}
37 +{%- from "neutron/map.jinja" import compute as neutron with context %}
40 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
42 +/etc/neutron/plugins/ml2/ml2_conf.ini:
44 + - source: salt://neutron/files/{{ neutron.version }}/_ml2_conf.vpp.ini
59 diff --git a/neutron/compute.sls b/neutron/compute.sls
60 index e815410..e99c110 100644
61 --- a/neutron/compute.sls
62 +++ b/neutron/compute.sls
63 @@ -111,7 +111,9 @@ neutron_metadata_agent:
64 {%- if compute.opendaylight is defined %}
65 {%- include "neutron/opendaylight/client.sls" %}
67 + {#- We can reuse this for ml2_vpp and ignore openvswitch_agent.ini #}
68 {%- include "neutron/ml2_ovs/init.sls" %}
69 + {%- include "neutron/agents/_vpp.sls" %}
72 {%- elif compute.backend.engine == "ovn" %}
73 diff --git a/neutron/files/queens/_ml2_conf.vpp.ini b/neutron/files/queens/_ml2_conf.vpp.ini
75 index 0000000..2373f64
77 +++ b/neutron/files/queens/_ml2_conf.vpp.ini
79 +{%- if pillar.neutron.server is defined %}
80 +{%- from "neutron/map.jinja" import server as neutron with context %}
81 +{%- elif pillar.neutron.gateway is defined %}
82 +{%- from "neutron/map.jinja" import gateway as neutron with context %}
84 +{%- from "neutron/map.jinja" import compute as neutron with context %}
87 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
89 +{%- set physnets_vpp = [] %}
90 +{%- set mechanism_vpp = neutron.backend.mechanism.vpp %}
91 +{%- for physnet, params in neutron.backend.get('physnets', {}).iteritems() %}
92 +{%- if params.get('vpp_interface', False) %}
93 +{%- do physnets_vpp.append([physnet, params.get('vpp_interface')]|join(":")) %}
96 +{%- if not physnets_vpp %}
97 +{%- do physnets_vpp.append('physnet1:tap-0') %}
100 +{%- if pillar.neutron.server is not defined %}
102 +type_drivers = flat,vlan
107 +etcd_insecure_explicit_disable_https = True
108 +l3_hosts = {{ mechanism_vpp.get('l3_hosts', '127.0.0.1') }}
109 +enable_l3_ha = False
112 +enable_vpp_restart = False
113 +etcd_pass = {{ mechanism_vpp.get('etcd_pass', '') }}
114 +etcd_user = {{ mechanism_vpp.get('etcd_user', '') }}
115 +etcd_port = {{ mechanism_vpp.get('etcd_port', 2379) }}
116 +etcd_host = {{ mechanism_vpp.get('etcd_host', '127.0.0.1') }}
117 +physnets = {{ ','.join(physnets_vpp) }}
120 diff --git a/neutron/files/queens/ml2_conf.ini b/neutron/files/queens/ml2_conf.ini
121 index bb2f126..057d325 100644
122 --- a/neutron/files/queens/ml2_conf.ini
123 +++ b/neutron/files/queens/ml2_conf.ini
124 @@ -28,6 +28,9 @@ agent_boot_time = {{ server.get('agent_boot_time', 180) }}
125 # List of network type driver entrypoints to be loaded from the
126 # neutron.ml2.type_drivers namespace. (list value)
127 #type_drivers = local,flat,vlan,gre,vxlan,geneve
128 +{%- if 'vpp' in server.backend.get('mechanism', []) %}
129 +type_drivers = flat,vlan
132 # Ordered list of network_types to allocate as tenant networks. The default
133 # value 'local' is useful for single-box testing but provides no connectivity
134 @@ -264,6 +267,8 @@ neutron_sync_mode = {{ _ovn.neutron_sync_mode|default('repair') }}
135 enable_distributed_floating_ip = {{ server.dvr|default('false') }}
138 +{%- include "neutron/files/queens/_ml2_conf.vpp.ini" %}
140 {%- if server.backend.opendaylight|default(False) %}
142 # HTTP URL of OpenDaylight REST interface. (string value)
143 diff --git a/neutron/gateway.sls b/neutron/gateway.sls
144 index 61b4372..ca07b9f 100644
145 --- a/neutron/gateway.sls
146 +++ b/neutron/gateway.sls
147 @@ -40,6 +40,8 @@ haproxy:
151 +{%- include "neutron/agents/_vpp.sls" %}
153 {%- if gateway.l2gw is defined %}
154 {%- include "neutron/agents/_l2gw.sls" %}
156 diff --git a/neutron/map.jinja b/neutron/map.jinja
157 index 78e2867..3e93b1f 100644
158 --- a/neutron/map.jinja
159 +++ b/neutron/map.jinja
161 {%- do compute_pkgs_ovn.extend(['neutron-common', 'python-networking-ovn', 'haproxy']) %}
163 {%- set linuxbridge_enabled = pillar.neutron.compute is defined and pillar.neutron.compute.get('backend', {}).get('mechanism', {}).get('lb', {}).get('driver', {}) == "linuxbridge" %}
164 +{%- set vpp_enabled = 'vpp' in pillar.neutron.get('compute', {}).get('backend', {}).get('mechanism', []) %}
165 {%- if linuxbridge_enabled %}
166 {%- set pkgs_cmp = ['neutron-linuxbridge-agent'] %}
167 {%- set services_cmp = ['neutron-linuxbridge-agent'] %}
168 +{%- elif vpp_enabled %}
169 +{%- set pkgs_cmp = ['vpp-agent'] %}
170 +{%- set services_cmp = ['vpp-agent'] %}
172 {%- set pkgs_cmp = ['neutron-openvswitch-agent', 'python-pycadf'] %}
173 {%- set services_cmp = ['neutron-openvswitch-agent'] %}
176 {%- set opendaylight_enabled = pillar.neutron.gateway is defined and pillar.neutron.gateway.opendaylight is defined %}
177 {%- set linuxbridge_enabled = pillar.neutron.gateway is defined and pillar.neutron.gateway.get('backend', {}).get('mechanism', {}).get('lb', {}).get('driver', {}) == "linuxbridge" %}
178 +{%- set vpp_enabled = 'vpp' in pillar.neutron.get('gateway', {}).get('backend', {}).get('mechanism', []) %}
179 {%- set pkgs_list = ['neutron-dhcp-agent', 'neutron-metadata-agent'] %}
180 {%- set services_list = ['neutron-metadata-agent', 'neutron-dhcp-agent'] %}
181 {%- if linuxbridge_enabled %}
182 {%- do pkgs_list.extend(['neutron-linuxbridge-agent', 'neutron-l3-agent']) %}
183 {%- do services_list.extend(['neutron-linuxbridge-agent', 'neutron-l3-agent']) %}
184 +{%- elif vpp_enabled %}
185 +{%- do pkgs_list.extend(['vpp-agent']) %}
186 +{%- do services_list.extend(['vpp-agent']) %}
187 +{%- if 'vpp-router' not in pillar.neutron.gateway.backend.get('router', '') %}
188 +{%- do pkgs_list.extend(['neutron-l3-agent']) %}
189 +{%- do services_list.extend(['neutron-l3-agent']) %}
191 {%- elif not opendaylight_enabled %}
192 {%- do pkgs_list.extend(['neutron-openvswitch-agent', 'neutron-l3-agent']) %}
193 {%- do services_list.extend(['neutron-openvswitch-agent', 'neutron-l3-agent']) %}
195 {%- do server_pkgs_list.append('python-networking-sfc') %}
198 +{%- if 'vpp' in pillar.neutron.get('server', {}).get('backend', {}).get('mechanism', []) %}
199 +{%- do server_pkgs_list.extend(['python-networking-vpp']) %}
202 {% set server = salt['grains.filter_by']({
203 'BaseDefaults': default_params,