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 diff --git a/neutron/agents/_vpp.sls b/neutron/agents/_vpp.sls
20 index 0000000..c1845d0
22 +++ b/neutron/agents/_vpp.sls
24 +{%- if pillar.neutron.gateway is defined %}
25 +{%- from "neutron/map.jinja" import gateway as neutron with context %}
27 +{%- from "neutron/map.jinja" import compute as neutron with context %}
30 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
32 +/etc/neutron/plugins/ml2/ml2_conf.ini:
34 + - source: salt://neutron/files/{{ neutron.version }}/_ml2_conf.vpp.ini
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" %}
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" %}
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
65 index 0000000..2373f64
67 +++ b/neutron/files/rocky/_ml2_conf.vpp.ini
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 %}
74 +{%- from "neutron/map.jinja" import compute as neutron with context %}
77 +{%- if 'vpp' in neutron.get('backend', {}).get('mechanism', []) %}
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(":")) %}
86 +{%- if not physnets_vpp %}
87 +{%- do physnets_vpp.append('physnet1:tap-0') %}
90 +{%- if pillar.neutron.server is not defined %}
92 +type_drivers = flat,vlan
97 +etcd_insecure_explicit_disable_https = True
98 +l3_hosts = {{ mechanism_vpp.get('l3_hosts', '127.0.0.1') }}
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) }}
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
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') }}
128 +{%- include "neutron/files/rocky/_ml2_conf.vpp.ini" %}
130 {%- if server.backend.opendaylight|default(False) %}
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:
140 +{%- include "neutron/agents/_vpp.sls" %}
142 {%- if gateway.l2gw is defined %}
143 {%- include "neutron/agents/_l2gw.sls" %}
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
150 {%- do compute_pkgs_ovn.extend(['neutron-common', 'python-networking-ovn', 'haproxy']) %}
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'] %}
161 {%- set pkgs_cmp = ['neutron-openvswitch-agent', 'python-pycadf'] %}
162 {%- set services_cmp = ['neutron-openvswitch-agent'] %}
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'] %}
170 {%- set services_list = ['neutron-metadata-agent'] %}
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']) %}
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']) %}
186 {%- set server_services_list = ['neutron-server'] %}
187 {%- do server_services_list.append('neutron-rpc-server') if wsgi_enabled %}
189 +{%- if 'vpp' in pillar.neutron.get('server', {}).get('backend', {}).get('mechanism', []) %}
190 +{%- do server_pkgs_list.extend(['python-networking-vpp']) %}
193 {% set server = salt['grains.filter_by']({
194 'BaseDefaults': default_params,