[fdio] salt-formula-neutron: Fix VPP support patch
[fuel.git] / mcp / patches / salt-formula-neutron / 0001-Bring-in-basic-VPP-support.patch
1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2019 Mirantis Inc., Enea AB and others.
3 :
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
12
13 TODO:
14 - update README
15
16 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
17 ---
18  neutron/agents/_vpp.sls               | 25 ++++++++++++++++
19  neutron/compute.sls                   |  2 ++
20  neutron/files/rocky/_ml2_conf.vpp.ini | 41 +++++++++++++++++++++++++++
21  neutron/files/rocky/ml2_conf.ini      |  4 +++
22  neutron/gateway.sls                   |  2 ++
23  neutron/map.jinja                     | 16 +++++++++++
24  6 files changed, 90 insertions(+)
25  create mode 100644 neutron/agents/_vpp.sls
26  create mode 100644 neutron/files/rocky/_ml2_conf.vpp.ini
27
28 diff --git a/neutron/agents/_vpp.sls b/neutron/agents/_vpp.sls
29 new file mode 100644
30 index 0000000..c1845d0
31 --- /dev/null
32 +++ b/neutron/agents/_vpp.sls
33 @@ -0,0 +1,25 @@
34 +{%- if pillar.neutron.gateway is defined %}
35 +{%- from "neutron/map.jinja" import gateway as neutron with context %}
36 +{%- else %}
37 +{%- from "neutron/map.jinja" import compute as neutron with context %}
38 +{%- endif %}
39 +
40 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
41 +
42 +/etc/neutron/plugins/ml2/ml2_conf.ini:
43 +  file.managed:
44 +  - source: salt://neutron/files/{{ neutron.version }}/_ml2_conf.vpp.ini
45 +  - mode: 0640
46 +  - user: root
47 +  - group: neutron
48 +  - template: jinja
49 +
50 +vpp:
51 +  service.running:
52 +    - enable: True
53 +
54 +vpp-agent:
55 +  service.running:
56 +    - enable: True
57 +
58 +{%- endif %}
59 diff --git a/neutron/compute.sls b/neutron/compute.sls
60 index 708a51d..3767011 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" %}
66      {%- else %}
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" %}
70      {%- endif %}
71
72    {%- elif compute.backend.engine == "ovn" %}
73 diff --git a/neutron/files/rocky/_ml2_conf.vpp.ini b/neutron/files/rocky/_ml2_conf.vpp.ini
74 new file mode 100644
75 index 0000000..2373f64
76 --- /dev/null
77 +++ b/neutron/files/rocky/_ml2_conf.vpp.ini
78 @@ -0,0 +1,41 @@
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 %}
83 +{%- else %}
84 +{%- from "neutron/map.jinja" import compute as neutron with context %}
85 +{%- endif %}
86 +
87 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
88 +
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(":")) %}
94 +{%-   endif %}
95 +{%- endfor %}
96 +{%- if not physnets_vpp %}
97 +{%-   do physnets_vpp.append('physnet1:tap-0') %}
98 +{%- endif %}
99 +
100 +{%- if pillar.neutron.server is not defined %}
101 +[ml2]
102 +type_drivers = flat,vlan
103 +{%- endif %}
104 +
105 +[ml2_vpp]
106 +jwt_signing = False
107 +etcd_insecure_explicit_disable_https = True
108 +l3_hosts = {{ mechanism_vpp.get('l3_hosts', '127.0.0.1') }}
109 +enable_l3_ha = False
110 +gpe_locators =
111 +gpe_src_cidr =
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) }}
118 +
119 +{%- endif %}
120 diff --git a/neutron/files/rocky/ml2_conf.ini b/neutron/files/rocky/ml2_conf.ini
121 index 48ad7df..4f323fa 100644
122 --- a/neutron/files/rocky/ml2_conf.ini
123 +++ b/neutron/files/rocky/ml2_conf.ini
124 @@ -27,6 +27,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
130 +{%- endif %}
131
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 @@ -239,6 +242,7 @@ neutron_sync_mode = {{ _ovn.neutron_sync_mode|default('repair') }}
135  enable_distributed_floating_ip = {{ server.dvr|default('false') }}
136  {%- endif %}
137
138 +{%- include "neutron/files/rocky/_ml2_conf.vpp.ini" %}
139
140  {%- if server.backend.opendaylight|default(False) %}
141  [ml2_odl]
142 diff --git a/neutron/gateway.sls b/neutron/gateway.sls
143 index 61b4372..ca07b9f 100644
144 --- a/neutron/gateway.sls
145 +++ b/neutron/gateway.sls
146 @@ -40,6 +40,8 @@ haproxy:
147
148  {%- endif %}
149
150 +{%- include "neutron/agents/_vpp.sls" %}
151 +
152  {%- if gateway.l2gw is defined %}
153  {%- include "neutron/agents/_l2gw.sls" %}
154  {%- endif %}
155 diff --git a/neutron/map.jinja b/neutron/map.jinja
156 index 1670a3f..3a03952 100644
157 --- a/neutron/map.jinja
158 +++ b/neutron/map.jinja
159 @@ -14,9 +14,13 @@
160  {%- do compute_pkgs_ovn.extend(['neutron-common', 'python-networking-ovn', 'haproxy']) %}
161  {%- endif %}
162  {%- set linuxbridge_enabled = pillar.neutron.compute is defined and pillar.neutron.compute.get('backend', {}).get('mechanism', {}).get('lb', {}).get('driver', {}) == "linuxbridge" %}
163 +{%- set vpp_enabled = 'vpp' in pillar.neutron.get('compute', {}).get('backend', {}).get('mechanism', []) %}
164  {%- if linuxbridge_enabled %}
165  {%- set pkgs_cmp = ['neutron-linuxbridge-agent'] %}
166  {%- set services_cmp = ['neutron-linuxbridge-agent'] %}
167 +{%- elif vpp_enabled %}
168 +{%- set pkgs_cmp = ['vpp-agent'] %}
169 +{%- set services_cmp = ['vpp-agent'] %}
170  {%- else %}
171  {%- set pkgs_cmp = ['neutron-openvswitch-agent', 'python-pycadf'] %}
172  {%- set services_cmp = ['neutron-openvswitch-agent'] %}
173 @@ -72,11 +76,19 @@
174
175  {%- set opendaylight_enabled = pillar.neutron.gateway is defined and pillar.neutron.gateway.opendaylight is defined %}
176  {%- set linuxbridge_enabled = pillar.neutron.gateway is defined and pillar.neutron.gateway.get('backend', {}).get('mechanism', {}).get('lb', {}).get('driver', {}) == "linuxbridge" %}
177 +{%- set vpp_enabled = 'vpp' in pillar.neutron.get('gateway', {}).get('backend', {}).get('mechanism', []) %}
178  {%- set pkgs_list = ['neutron-dhcp-agent', 'neutron-metadata-agent'] %}
179  {%- set services_list = ['neutron-metadata-agent', 'neutron-dhcp-agent'] %}
180  {%- if linuxbridge_enabled %}
181  {%- do pkgs_list.extend(['neutron-linuxbridge-agent', 'neutron-l3-agent']) %}
182  {%- do services_list.extend(['neutron-linuxbridge-agent', 'neutron-l3-agent']) %}
183 +{%- elif vpp_enabled %}
184 +{%- do pkgs_list.extend(['vpp-agent']) %}
185 +{%- do services_list.extend(['vpp-agent']) %}
186 +{%- if 'vpp-router' not in pillar.neutron.gateway.backend.get('router', '') %}
187 +{%- do pkgs_list.extend(['neutron-l3-agent']) %}
188 +{%- do services_list.extend(['neutron-l3-agent']) %}
189 +{%- endif %}
190  {%- elif not opendaylight_enabled %}
191  {%- do pkgs_list.extend(['neutron-openvswitch-agent', 'neutron-l3-agent']) %}
192  {%- do services_list.extend(['neutron-openvswitch-agent', 'neutron-l3-agent']) %}
193 @@ -124,6 +136,10 @@
194  {%- do server_pkgs_list.append('python-networking-sfc') %}
195  {%- endif %}
196
197 +{%- if 'vpp' in pillar.neutron.get('server', {}).get('backend', {}).get('mechanism', []) %}
198 +{%- do server_pkgs_list.extend(['python-networking-vpp']) %}
199 +{%- endif %}
200 +
201  {% set server = salt['grains.filter_by']({
202      'BaseDefaults': default_params,
203      'Debian': {