From 452a2b668bb4a3ac6299fd99233bf7a813b095f9 Mon Sep 17 00:00:00 2001 From: Periyasamy Palanisamy Date: Fri, 11 May 2018 11:28:45 +0200 Subject: [PATCH] Public n/w access for vxlan tenant n/w in ml2.ovs Currently neutron role doesn't configure l3 agent (controller) for external network connecitivity for the openstack tenant network. This needs some manual configuration to provide public network access for the tenant VMs. This review attempts to automate these steps. Change-Id: I653ee5136ac508c473cbdb761a00454a774a4336 Signed-off-by: Periyasamy Palanisamy --- doc/source/app-openvswitch.rst | 10 ++++++ tasks/providers/ovs_l3_config.yml | 34 +++++++++++++++++++ .../plugins/ml2/openvswitch_agent.ini.j2 | 5 ++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 tasks/providers/ovs_l3_config.yml diff --git a/doc/source/app-openvswitch.rst b/doc/source/app-openvswitch.rst index 6aa3ccbe..20351ff0 100644 --- a/doc/source/app-openvswitch.rst +++ b/doc/source/app-openvswitch.rst @@ -165,6 +165,16 @@ Set the following user variables in your network_vlan_ranges: "physnet1:102:199" network_mappings: "physnet1:br-provider" + # When using Open vSwitch, Tenant network is of type vxlan and want + # to provide the external network connectivity over flat provider + # network, then configure neutron_provider_networks like following. + neutron_provider_networks: + network_flat_networks: "*" + network_types: "vxlan" + network_vxlan_ranges: "1:1000" + network_mappings: "provider:br-provider" + network_interface: eth12 + Customization is needed to support additional network types such as vxlan, GRE or Geneve. Refer to the `neutron agent configuration `_ for diff --git a/tasks/providers/ovs_l3_config.yml b/tasks/providers/ovs_l3_config.yml new file mode 100644 index 00000000..ee46947e --- /dev/null +++ b/tasks/providers/ovs_l3_config.yml @@ -0,0 +1,34 @@ +--- +# Copyright 2018, Ericsson AB and Others +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +- name: Setup External Network Provider Bridge + openvswitch_bridge: + bridge: "{{ neutron_provider_networks.network_mappings.split(':')[1] }}" + state: present + when: + - neutron_services['neutron-l3-agent']['group'] in group_names + - neutron_plugin_type == 'ml2.ovs' + - neutron_provider_networks.network_mappings is defined + +- name: Add port to External Network Provider Bridge + openvswitch_port: + bridge: "{{ neutron_provider_networks.network_mappings.split(':')[1] }}" + port: "{{ neutron_provider_networks.network_interface }}" + state: present + when: + - neutron_services['neutron-l3-agent']['group'] in group_names + - neutron_plugin_type == 'ml2.ovs' + - neutron_provider_networks.network_mappings is defined + - neutron_provider_networks.network_interface is defined diff --git a/templates/plugins/ml2/openvswitch_agent.ini.j2 b/templates/plugins/ml2/openvswitch_agent.ini.j2 index 058c8970..91796c3c 100644 --- a/templates/plugins/ml2/openvswitch_agent.ini.j2 +++ b/templates/plugins/ml2/openvswitch_agent.ini.j2 @@ -4,7 +4,10 @@ {% if neutron_tunnel_types | length > 0 %} local_ip = {{ neutron_local_ip }} {% endif %} -{% if neutron_provider_networks.network_mappings is defined and ((neutron_provider_networks.network_mappings | length) > 0) %} +{% if neutron_plugin_type != 'ml2.ovs' and neutron_provider_networks.network_mappings is defined and ((neutron_provider_networks.network_mappings | length) > 0) %} +bridge_mappings = {{ neutron_provider_networks.network_mappings }} +{% endif %} +{% if neutron_services['neutron-l3-agent']['group'] in group_names and neutron_plugin_type == 'ml2.ovs' and neutron_provider_networks.network_mappings is defined and ((neutron_provider_networks.network_mappings | length) > 0) %} bridge_mappings = {{ neutron_provider_networks.network_mappings }} {% endif %}