1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2019 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/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
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 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" %}
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/rocky/_ml2_conf.vpp.ini b/neutron/files/rocky/_ml2_conf.vpp.ini
75 index 0000000..2373f64
77 +++ b/neutron/files/rocky/_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/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
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') }}
138 +{%- include "neutron/files/rocky/_ml2_conf.vpp.ini" %}
140 {%- if server.backend.opendaylight|default(False) %}
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:
150 +{%- include "neutron/agents/_vpp.sls" %}
152 {%- if gateway.l2gw is defined %}
153 {%- include "neutron/agents/_l2gw.sls" %}
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
160 {%- do compute_pkgs_ovn.extend(['neutron-common', 'python-networking-ovn', 'haproxy']) %}
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'] %}
171 {%- set pkgs_cmp = ['neutron-openvswitch-agent', 'python-pycadf'] %}
172 {%- set services_cmp = ['neutron-openvswitch-agent'] %}
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']) %}
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']) %}
194 {%- do server_pkgs_list.append('python-networking-sfc') %}
197 +{%- if 'vpp' in pillar.neutron.get('server', {}).get('backend', {}).get('mechanism', []) %}
198 +{%- do server_pkgs_list.extend(['python-networking-vpp']) %}
201 {% set server = salt['grains.filter_by']({
202 'BaseDefaults': default_params,