From 297b15df24c8483df1bf6e0fcccbeba59653917d Mon Sep 17 00:00:00 2001 From: Manuel Buil Date: Fri, 30 Nov 2018 18:24:12 +0100 Subject: [PATCH] Provide support for ovs-sfc Currently we could only deploy odl-sfc, this patch provides support for sfc created through the ovs agent Change-Id: I41bb95385255cb5b445e1a8a4388ddef509dbad7 Signed-off-by: Manuel Buil --- doc/source/app-openvswitch-sfc.rst | 80 +++++++++++++++++++ tasks/neutron_install_source.yml | 1 + tasks/providers/opendaylight_config.yml | 2 +- templates/neutron.conf.j2 | 4 +- .../plugins/ml2/openvswitch_agent.ini.j2 | 11 ++- tests/neutron-overrides-ovs-sfc.yml | 41 ++++++++++ tox.ini | 8 ++ vars/main.yml | 8 +- zuul.d/jobs.yaml | 6 ++ zuul.d/project.yaml | 2 + 10 files changed, 156 insertions(+), 7 deletions(-) create mode 100644 doc/source/app-openvswitch-sfc.rst create mode 100644 tests/neutron-overrides-ovs-sfc.yml diff --git a/doc/source/app-openvswitch-sfc.rst b/doc/source/app-openvswitch-sfc.rst new file mode 100644 index 00000000..f6aca09a --- /dev/null +++ b/doc/source/app-openvswitch-sfc.rst @@ -0,0 +1,80 @@ +====================================== +Scenario - Using Open vSwitch with SFC +====================================== + +Overview +~~~~~~~~ + +Operators can choose to configure SFC mechanism with Open vSwitch +instead of ODL through the neutron networking-sfc project. The SFC +configuration results in OVS flows being configured with SFC +specifics using MPLS as dataplane technology. This document +outlines how to set it up in your environment. + +Recommended reading +~~~~~~~~~~~~~~~~~~~ + +We recommend that you read the following documents before proceeding: + + * General overview of neutron networking-sfc: + ``_ + * How to configure networking-sfc in neutron: + ``_ + +Prerequisites +~~~~~~~~~~~~~ + +Configure your networking according the Open vSwitch setup: + +* Scenario - Using Open vSwitch + ``_ + +OpenStack-Ansible user variables +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Create a group var file for your network hosts +``/etc/openstack_deploy/group_vars/network_hosts``. It has to include: + +.. code-block:: yaml + + # Ensure the openvswitch kernel module is loaded + openstack_host_specific_kernel_modules: + - name: "openvswitch" + pattern: "CONFIG_OPENVSWITCH" + +Set the following user variables in your +``/etc/openstack_deploy/user_variables.yml``: + +.. code-block:: yaml + + ### neutron specific config + neutron_plugin_type: ml2.ovs + + neutron_ml2_drivers_type: "flat,vlan" + + neutron_plugin_base: + - router + - metering + - networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin + - networking_sfc.services.sfc.plugin.SfcPlugin + + # Typically this would be defined by the os-neutron-install + # playbook. The provider_networks library would parse the + # provider_networks list in openstack_user_config.yml and + # generate the values of network_types, network_vlan_ranges + # and network_mappings. network_mappings would have a + # different value for each host in the inventory based on + # whether or not the host was metal (typically a compute host) + # or a container (typically a neutron agent container) + # + # When using Open vSwitch, we override it to take into account + # the Open vSwitch bridge we are going to define outside of + # OpenStack-Ansible plays + neutron_provider_networks: + network_flat_networks: "*" + network_types: "vlan" + network_vlan_ranges: "physnet1:102:199" + network_mappings: "physnet1:br-provider" + +**Note:** The only difference to the Standard Open vSwitch configuration +is the setting of the ``neutron_plugin_base``. diff --git a/tasks/neutron_install_source.yml b/tasks/neutron_install_source.yml index 1470e731..1d263ed9 100644 --- a/tasks/neutron_install_source.yml +++ b/tasks/neutron_install_source.yml @@ -49,6 +49,7 @@ (neutron_fwaas_v2 | bool) | ternary(neutron_optional_fwaas_pip_packages, []) + (neutron_lbaasv2 | bool) | ternary(neutron_optional_lbaas_pip_packages, []) + (neutron_vpnaas | bool) | ternary(neutron_optional_vpnaas_pip_packages, []) + + (neutron_sfc | bool) | ternary(neutron_optional_sfc_pip_packages, []) + (neutron_oslomsg_amqp1_enabled | bool) | ternary(neutron_optional_oslomsg_amqp1_pip_packages, []) }} venv_facts_when_changed: - section: "neutron" diff --git a/tasks/providers/opendaylight_config.yml b/tasks/providers/opendaylight_config.yml index c8ae1de4..bf8461be 100644 --- a/tasks/providers/opendaylight_config.yml +++ b/tasks/providers/opendaylight_config.yml @@ -18,7 +18,7 @@ neutron_optional_combined_pip_packages: |- {% set packages = neutron_optional_opendaylight_pip_packages %} {% if 'networking_sfc.services.sfc.plugin.SfcPlugin' in neutron_plugin_base %} - {% set _ = packages.extend(neutron_optional_opendaylight_sfc_pip_packages) %} + {% set _ = packages.extend(neutron_optional_sfc_pip_packages) %} {% endif %} {{ packages }} diff --git a/templates/neutron.conf.j2 b/templates/neutron.conf.j2 index 5ec92163..f725578e 100644 --- a/templates/neutron.conf.j2 +++ b/templates/neutron.conf.j2 @@ -270,8 +270,8 @@ lock_path = {{ neutron_lock_path }} {% if neutron_services['neutron-server']['group'] in group_names and 'networking_sfc.services.sfc.plugin.SfcPlugin' in neutron_plugin_base %} # ODL-SFC [sfc] -drivers = odl_v2 +drivers = {{ (neutron_plugin_type == 'ml2.opendaylight') | ternary('odl_v2', 'ovs') }} [flowclassifier] -drivers = odl_v2 +drivers = {{ (neutron_plugin_type == 'ml2.opendaylight') | ternary('odl_v2', 'ovs') }} {% endif %} diff --git a/templates/plugins/ml2/openvswitch_agent.ini.j2 b/templates/plugins/ml2/openvswitch_agent.ini.j2 index 91796c3c..ec07d2a2 100644 --- a/templates/plugins/ml2/openvswitch_agent.ini.j2 +++ b/templates/plugins/ml2/openvswitch_agent.ini.j2 @@ -15,9 +15,14 @@ bridge_mappings = {{ neutron_provider_networks.network_mappings }} l2_population = {{ neutron_plugins[neutron_plugin_type].l2_population }} tunnel_types = {{ neutron_tunnel_types }} enable_distributed_routing = {{ neutron_plugins[neutron_plugin_type].router_distributed | default('False') }} -{% if 'qos' in neutron_plugin_base %} -extensions = qos -{% endif %} +{% set ovs_agent_extensions = [] %} +{% if 'qos' in neutron_plugin_base %} +{% set _ = ovs_agent_extensions.append("qos") %} +{% endif %} +{% if 'networking_sfc.services.sfc.plugin.SfcPlugin' in neutron_plugin_base %} +{% set _ = ovs_agent_extensions.append("sfc") %} +{% endif %} +extensions = {{ ovs_agent_extensions | join(',') }} # Security groups [securitygroup] diff --git a/tests/neutron-overrides-ovs-sfc.yml b/tests/neutron-overrides-ovs-sfc.yml new file mode 100644 index 00000000..58d37589 --- /dev/null +++ b/tests/neutron-overrides-ovs-sfc.yml @@ -0,0 +1,41 @@ +--- +# Copyright 2017, Intracom-Telecom +# +# 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. + +### Use OpenDaylight SDN Controller +neutron_plugin_type: "ml2.ovs" + +openstack_host_specific_kernel_modules: + - name: "openvswitch" + pattern: "CONFIG_OPENVSWITCH" +group: "physical_host" + +neutron_plugin_base: + - router + - metering + - networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin + - networking_sfc.services.sfc.plugin.SfcPlugin + +tempest_run: yes + +tempest_plugins: + - name: neutron + repo: https://git.openstack.org/openstack/neutron + branch: master + - name: neutron-plugins + repo: https://git.openstack.org/openstack/neutron-tempest-plugin + branch: master + +tempest_test_whitelist: + - "neutron_tempest_plugin.api.test_networks*" diff --git a/tox.ini b/tox.ini index 1a32baa0..aacaa3ab 100644 --- a/tox.ini +++ b/tox.ini @@ -167,6 +167,14 @@ commands = bash -c "{toxinidir}/tests/common/test-ansible-functional.sh" +[testenv:ovs-sfc] +setenv = + {[testenv]setenv} + ANSIBLE_INVENTORY={toxinidir}/tests/ovs_inventory + ANSIBLE_OVERRIDES={toxinidir}/tests/neutron-overrides-ovs-sfc.yml +commands = + bash -c "{toxinidir}/tests/common/test-ansible-functional.sh" + [testenv:linters] basepython = python3 commands = diff --git a/vars/main.yml b/vars/main.yml index 2e0c3e05..464d12c5 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -68,7 +68,7 @@ neutron_optional_opendaylight_pip_packages: - ceilometer - networking-bgpvpn -neutron_optional_opendaylight_sfc_pip_packages: +neutron_optional_sfc_pip_packages: - networking-sfc neutron_proprietary_nuage_pip_packages: @@ -303,6 +303,12 @@ neutron_bgp_router_id: "{{ neutron_local_ip }}" neutron_port_forwarding: "{{ ('port_forwarding' in neutron_plugin_base) | ternary('True', 'False') }}" +### +### Service Function Chaining +### + +neutron_sfc: "{{ ('networking_sfc.services.sfc.plugin.SfcPlugin' in neutron_plugin_base) | ternary('True', 'False') }}" + ### ### Services info ### diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 7d1fd296..15c585ad 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -55,6 +55,12 @@ vars: tox_env: odl-sfc +- job: + name: openstack-ansible-ovs-sfc-ubuntu-xenial + parent: openstack-ansible-functional-ubuntu-xenial + vars: + tox_env: ovs-sfc + - job: name: openstack-ansible-opendaylight-bgpvpn-ubuntu-xenial parent: openstack-ansible-functional-ubuntu-xenial diff --git a/zuul.d/project.yaml b/zuul.d/project.yaml index 0b8db5d6..907eb735 100644 --- a/zuul.d/project.yaml +++ b/zuul.d/project.yaml @@ -29,6 +29,8 @@ - openstack-ansible-opendaylight-ubuntu-xenial - openstack-ansible-ovs-nsh-ubuntu-xenial - openstack-ansible-odl-sfc-ubuntu-xenial + - openstack-ansible-ovs-sfc-ubuntu-xenial: + voting: false - openstack-ansible-opendaylight-bgpvpn-ubuntu-xenial: voting: false gate: