[virtual] Update OpenStack version to Stein
[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 diff --git a/neutron/agents/_vpp.sls b/neutron/agents/_vpp.sls
19 new file mode 100644
20 index 0000000..c1845d0
21 --- /dev/null
22 +++ b/neutron/agents/_vpp.sls
23 @@ -0,0 +1,25 @@
24 +{%- if pillar.neutron.gateway is defined %}
25 +{%- from "neutron/map.jinja" import gateway as neutron with context %}
26 +{%- else %}
27 +{%- from "neutron/map.jinja" import compute as neutron with context %}
28 +{%- endif %}
29 +
30 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
31 +
32 +/etc/neutron/plugins/ml2/ml2_conf.ini:
33 +  file.managed:
34 +  - source: salt://neutron/files/{{ neutron.version }}/_ml2_conf.vpp.ini
35 +  - mode: 0640
36 +  - user: root
37 +  - group: neutron
38 +  - template: jinja
39 +
40 +vpp:
41 +  service.running:
42 +    - enable: True
43 +
44 +vpp-agent:
45 +  service.running:
46 +    - enable: True
47 +
48 +{%- endif %}
49 diff --git a/neutron/compute.sls b/neutron/compute.sls
50 index 708a51d..3767011 100644
51 --- a/neutron/compute.sls
52 +++ b/neutron/compute.sls
53 @@ -111,7 +111,9 @@ neutron_metadata_agent:
54      {%- if compute.opendaylight is defined %}
55        {%- include "neutron/opendaylight/client.sls" %}
56      {%- else %}
57 +      {#- We can reuse this for ml2_vpp and ignore openvswitch_agent.ini #}
58        {%- include "neutron/ml2_ovs/init.sls" %}
59 +      {%- include "neutron/agents/_vpp.sls" %}
60      {%- endif %}
61  
62    {%- elif compute.backend.engine == "ovn" %}
63 diff --git a/neutron/files/rocky/_ml2_conf.vpp.ini b/neutron/files/rocky/_ml2_conf.vpp.ini
64 new file mode 100644
65 index 0000000..2373f64
66 --- /dev/null
67 +++ b/neutron/files/rocky/_ml2_conf.vpp.ini
68 @@ -0,0 +1,41 @@
69 +{%- if pillar.neutron.server is defined %}
70 +{%- from "neutron/map.jinja" import server as neutron with context %}
71 +{%- elif pillar.neutron.gateway is defined %}
72 +{%- from "neutron/map.jinja" import gateway as neutron with context %}
73 +{%- else %}
74 +{%- from "neutron/map.jinja" import compute as neutron with context %}
75 +{%- endif %}
76 +
77 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
78 +
79 +{%- set physnets_vpp = [] %}
80 +{%- set mechanism_vpp = neutron.backend.mechanism.vpp %}
81 +{%- for physnet, params in neutron.backend.get('physnets', {}).iteritems() %}
82 +{%-   if params.get('vpp_interface', False) %}
83 +{%-     do physnets_vpp.append([physnet, params.get('vpp_interface')]|join(":")) %}
84 +{%-   endif %}
85 +{%- endfor %}
86 +{%- if not physnets_vpp %}
87 +{%-   do physnets_vpp.append('physnet1:tap-0') %}
88 +{%- endif %}
89 +
90 +{%- if pillar.neutron.server is not defined %}
91 +[ml2]
92 +type_drivers = flat,vlan
93 +{%- endif %}
94 +
95 +[ml2_vpp]
96 +jwt_signing = False
97 +etcd_insecure_explicit_disable_https = True
98 +l3_hosts = {{ mechanism_vpp.get('l3_hosts', '127.0.0.1') }}
99 +enable_l3_ha = False
100 +gpe_locators =
101 +gpe_src_cidr =
102 +enable_vpp_restart = False
103 +etcd_pass = {{ mechanism_vpp.get('etcd_pass', '') }}
104 +etcd_user = {{ mechanism_vpp.get('etcd_user', '') }}
105 +etcd_port = {{ mechanism_vpp.get('etcd_port', 2379) }}
106 +etcd_host = {{ mechanism_vpp.get('etcd_host', '127.0.0.1') }}
107 +physnets = {{ ','.join(physnets_vpp) }}
108 +
109 +{%- endif %}
110 diff --git a/neutron/files/rocky/ml2_conf.ini b/neutron/files/rocky/ml2_conf.ini
111 index a9a598f..4429c80 100644
112 --- a/neutron/files/rocky/ml2_conf.ini
113 +++ b/neutron/files/rocky/ml2_conf.ini
114 @@ -27,6 +27,9 @@ agent_boot_time = {{ server.get('agent_boot_time', 180) }}
115  # List of network type driver entrypoints to be loaded from the
116  # neutron.ml2.type_drivers namespace. (list value)
117  #type_drivers = local,flat,vlan,gre,vxlan,geneve
118 +{%- if 'vpp' in server.backend.get('mechanism', []) %}
119 +type_drivers = flat,vlan
120 +{%- endif %}
121  
122  # Ordered list of network_types to allocate as tenant networks. The default
123  # value 'local' is useful for single-box testing but provides no connectivity
124 @@ -239,6 +242,7 @@ neutron_sync_mode = {{ _ovn.neutron_sync_mode|default('repair') }}
125  enable_distributed_floating_ip = {{ server.dvr|default('false') }}
126  {%- endif %}
127  
128 +{%- include "neutron/files/rocky/_ml2_conf.vpp.ini" %}
129  
130  {%- if server.backend.opendaylight|default(False) %}
131  [ml2_odl]
132 diff --git a/neutron/gateway.sls b/neutron/gateway.sls
133 index e51990a..95d4d07 100644
134 --- a/neutron/gateway.sls
135 +++ b/neutron/gateway.sls
136 @@ -40,6 +40,8 @@ haproxy:
137  
138  {%- endif %}
139  
140 +{%- include "neutron/agents/_vpp.sls" %}
141 +
142  {%- if gateway.l2gw is defined %}
143  {%- include "neutron/agents/_l2gw.sls" %}
144  {%- endif %}
145 diff --git a/neutron/map.jinja b/neutron/map.jinja
146 index 9e6cb36..17cd5b3 100644
147 --- a/neutron/map.jinja
148 +++ b/neutron/map.jinja
149 @@ -14,9 +14,13 @@
150  {%- do compute_pkgs_ovn.extend(['neutron-common', 'python-networking-ovn', 'haproxy']) %}
151  {%- endif %}
152  {%- set linuxbridge_enabled = pillar.neutron.compute is defined and pillar.neutron.compute.get('backend', {}).get('mechanism', {}).get('lb', {}).get('driver', {}) == "linuxbridge" %}
153 +{%- set vpp_enabled = 'vpp' in pillar.neutron.get('compute', {}).get('backend', {}).get('mechanism', []) %}
154  {%- if linuxbridge_enabled %}
155  {%- set pkgs_cmp = ['neutron-linuxbridge-agent'] %}
156  {%- set services_cmp = ['neutron-linuxbridge-agent'] %}
157 +{%- elif vpp_enabled %}
158 +{%- set pkgs_cmp = ['vpp-agent'] %}
159 +{%- set services_cmp = ['vpp-agent'] %}
160  {%- else %}
161  {%- set pkgs_cmp = ['neutron-openvswitch-agent', 'python-pycadf'] %}
162  {%- set services_cmp = ['neutron-openvswitch-agent'] %}
163 @@ -73,6 +77,7 @@
164  {%- set opendaylight_enabled = pillar.neutron.gateway is defined and pillar.neutron.gateway.opendaylight is defined %}
165  {%- set linuxbridge_enabled = pillar.neutron.gateway is defined and pillar.neutron.gateway.get('backend', {}).get('mechanism', {}).get('lb', {}).get('driver', {}) == "linuxbridge" %}
166  {%- set dhcp_enabled = pillar.neutron.gateway is defined and pillar.neutron.gateway.get('dhcp_agent_enabled', True) %}
167 +{%- set vpp_enabled = 'vpp' in pillar.neutron.get('gateway', {}).get('backend', {}).get('mechanism', []) %}
168  {%- set pkgs_list = ['neutron-metadata-agent'] %}
169  
170  {%- set services_list = ['neutron-metadata-agent'] %}
171 @@ -83,6 +88,13 @@
172  {%- if linuxbridge_enabled %}
173  {%- do pkgs_list.extend(['neutron-linuxbridge-agent', 'neutron-l3-agent']) %}
174  {%- do services_list.extend(['neutron-linuxbridge-agent', 'neutron-l3-agent']) %}
175 +{%- elif vpp_enabled %}
176 +{%- do pkgs_list.extend(['vpp-agent']) %}
177 +{%- do services_list.extend(['vpp-agent']) %}
178 +{%- if 'vpp-router' not in pillar.neutron.gateway.backend.get('router', '') %}
179 +{%- do pkgs_list.extend(['neutron-l3-agent']) %}
180 +{%- do services_list.extend(['neutron-l3-agent']) %}
181 +{%- endif %}
182  {%- elif not opendaylight_enabled %}
183  {%- do pkgs_list.extend(['neutron-openvswitch-agent', 'neutron-l3-agent']) %}
184  {%- do services_list.extend(['neutron-openvswitch-agent', 'neutron-l3-agent']) %}
185 @@ -132,6 +144,10 @@
186  {%- set server_services_list = ['neutron-server'] %}
187  {%- do server_services_list.append('neutron-rpc-server') if wsgi_enabled %}
188  
189 +{%- if 'vpp' in pillar.neutron.get('server', {}).get('backend', {}).get('mechanism', []) %}
190 +{%- do server_pkgs_list.extend(['python-networking-vpp']) %}
191 +{%- endif %}
192 +
193  {% set server = salt['grains.filter_by']({
194      'BaseDefaults': default_params,
195      'Debian': {