From 8a01ed32702b7c849c744b6cc593b76bdb78cab1 Mon Sep 17 00:00:00 2001 From: prithiv Date: Tue, 13 Sep 2016 11:24:53 +0100 Subject: [PATCH] Add Networking-SFC role Networking-SFC is a neutron big-tent project support Service Function Chaining in Neutron. * Rename the image from neutron-networking-sfc-agent to neutron-sfc-agent. * Add networking-sfc role in playbooks. Co-Authored-by: Jeffrey Zhang Change-Id: I1f99650eed85f59929d4ab6b2226603c54f29577 Implements: blueprint enable-networking-sfc-support --- ansible/group_vars/all.yml | 2 +- ansible/roles/neutron/defaults/main.yml | 4 ++ ansible/roles/neutron/tasks/start.yml | 49 +++++++++++++++++++ .../roles/neutron/templates/neutron.conf.j2 | 8 ++- .../Dockerfile.j2 | 10 ++-- .../extend_start.sh | 0 kolla/common/config.py | 2 +- .../add-networking-sfc-62ae433ed7aa4e33.yaml | 5 ++ tests/test_build.py | 6 +-- 9 files changed, 75 insertions(+), 11 deletions(-) rename docker/neutron/{neutron-networking-sfc-agent => neutron-sfc-agent}/Dockerfile.j2 (65%) rename docker/neutron/{neutron-networking-sfc-agent => neutron-sfc-agent}/extend_start.sh (100%) create mode 100644 releasenotes/notes/add-networking-sfc-62ae433ed7aa4e33.yaml diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 83d504a974..ab15810969 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -110,7 +110,7 @@ tunnel_interface: "{{ network_interface }}" bifrost_network_interface: "{{ network_interface }}" -# Valid options are [ openvswitch, linuxbridge ] +# Valid options are [ openvswitch, linuxbridge, sfc ] neutron_plugin_agent: "openvswitch" # The default ports used by each service. diff --git a/ansible/roles/neutron/defaults/main.yml b/ansible/roles/neutron/defaults/main.yml index 21ef9a49f9..0de2a597f7 100644 --- a/ansible/roles/neutron/defaults/main.yml +++ b/ansible/roles/neutron/defaults/main.yml @@ -36,6 +36,10 @@ neutron_openvswitch_agent_image: "{{ docker_registry ~ '/' if docker_registry el neutron_openvswitch_agent_tag: "{{ openstack_release }}" neutron_openvswitch_agent_image_full: "{{ neutron_openvswitch_agent_image }}:{{ neutron_openvswitch_agent_tag }}" +neutron_sfc_agent_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-neutron-sfc-agent" +neutron_sfc_agent_tag: "{{ openstack_release }}" +neutron_sfc_agent_image_full: "{{ neutron_sfc_agent_image }}:{{ neutron_sfc_agent_tag }}" + neutron_server_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-neutron-server" neutron_server_tag: "{{ openstack_release }}" neutron_server_image_full: "{{ neutron_server_image }}:{{ neutron_server_tag }}" diff --git a/ansible/roles/neutron/tasks/start.yml b/ansible/roles/neutron/tasks/start.yml index 0d29efe256..696fcf3323 100644 --- a/ansible/roles/neutron/tasks/start.yml +++ b/ansible/roles/neutron/tasks/start.yml @@ -109,6 +109,36 @@ ) - neutron_plugin_agent == "openvswitch" +- name: Starting neutron-sfc-agent container + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ neutron_sfc_agent_image_full }}" + name: "neutron_sfc_agent" + privileged: True + volumes: + - "{{ node_config_directory }}/neutron-sfc-agent/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "/lib/modules:/lib/modules:ro" + - "/run:/run" + - "kolla_logs:/var/log/kolla/" + when: + - ( + ( inventory_hostname in groups['compute'] + or (enable_manila | bool and inventory_hostname in groups['manila-share']) + or inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + and not enable_nova_fake | bool + ) or + ( inventory_hostname in groups['neutron-dhcp-agent'] + or inventory_hostname in groups['neutron-l3-agent'] + or inventory_hostname in groups['neutron-metadata-agent'] + and enable_nova_fake | bool + ) + ) + - neutron_plugin_agent == "sfc" + - name: Starting neutron-openvswitch-agent container for fake nova compute kolla_docker: action: "start_container" @@ -128,6 +158,25 @@ - neutron_plugin_agent == "openvswitch" - enable_nova_fake | bool +- name: Starting neutron-sfc-agent container for fake nova compute + kolla_docker: + action: "start_container" + common_options: "{{ docker_common_options }}" + image: "{{ neutron_sfc_agent_image_full }}" + name: "neutron_sfc_agent_fake_{{ item }}" + privileged: True + volumes: + - "{{ node_config_directory }}/neutron-sfc-agent-fake-{{ item }}/:{{ container_config_directory }}/:ro" + - "/etc/localtime:/etc/localtime:ro" + - "/lib/modules:/lib/modules:ro" + - "/run:/run" + - "kolla_logs:/var/log/kolla/" + with_sequence: start=1 end={{ num_nova_fake_per_node }} + when: + - inventory_hostname in groups['compute'] + - neutron_plugin_agent == "sfc" + - enable_nova_fake | bool + - name: Starting neutron-linuxbridge-agent container kolla_docker: action: "start_container" diff --git a/ansible/roles/neutron/templates/neutron.conf.j2 b/ansible/roles/neutron/templates/neutron.conf.j2 index 87dfb4729f..6d7a051a7b 100644 --- a/ansible/roles/neutron/templates/neutron.conf.j2 +++ b/ansible/roles/neutron/templates/neutron.conf.j2 @@ -35,7 +35,7 @@ host = {{ ansible_hostname }}_{{ item }} allow_overlapping_ips = true core_plugin = ml2 -service_plugins = router{% if enable_neutron_lbaas | bool %},neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2{% endif %}{% if enable_neutron_qos | bool %},qos{% endif %} +service_plugins = router{% if enable_neutron_lbaas | bool %},lbaas{% endif %}{% if enable_neutron_qos | bool %},qos{% endif %},{% if neutron_plugin_agent == "sfc" %}flow_classifier,sfc{% endif %} {% if enable_neutron_agent_ha | bool %} dhcp_agents_per_network = {{ dhcp_agents_per_network }} @@ -100,3 +100,9 @@ topics = notifications {% else %} driver = noop {% endif %} + +{% if neutron_plugin_agent == "sfc" %} +[sfc] +drivers = ovs +[flowclassifier] +{% endif %} diff --git a/docker/neutron/neutron-networking-sfc-agent/Dockerfile.j2 b/docker/neutron/neutron-sfc-agent/Dockerfile.j2 similarity index 65% rename from docker/neutron/neutron-networking-sfc-agent/Dockerfile.j2 rename to docker/neutron/neutron-sfc-agent/Dockerfile.j2 index 1582ea9a7c..2c30a2242b 100644 --- a/docker/neutron/neutron-networking-sfc-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-sfc-agent/Dockerfile.j2 @@ -10,10 +10,10 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \ {% elif install_type == 'source' %} -ADD neutron-networking-sfc-agent-archive /neutron-networking-sfc-agent-source -RUN ln -s neutron-networking-sfc-agent-source/* neutron_networking-sfc-agent \ - && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /neutron_networking-sfc-agent \ - && cp /neutron_networking-sfc-agent/etc/neutron/rootwrap.d/* /etc/neutron/rootwrap.d \ +ADD neutron-sfc-agent-archive /neutron-sfc-agent-source +RUN ln -s neutron-sfc-agent-source/* neutron-sfc-agent \ + && /var/lib/kolla/venv/bin/pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /neutron-sfc-agent \ + && cp /neutron-sfc-agent/etc/neutron/rootwrap.d/* /etc/neutron/rootwrap.d \ && sed -i 's|^exec_dirs.*|exec_dirs=/var/lib/kolla/venv/bin,/sbin,/usr/sbin,/bin,/usr/bin,/usr/local/bin,/usr/local/sbin|g' /etc/neutron/rootwrap.conf {% endif %} @@ -21,7 +21,7 @@ RUN ln -s neutron-networking-sfc-agent-source/* neutron_networking-sfc-agent \ COPY extend_start.sh /usr/local/bin/kolla_neutron_extend_start RUN chmod 755 /usr/local/bin/kolla_neutron_extend_start -{% block neutron_networking_sfc_agent_footer %}{% endblock %} +{% block neutron_sfc_agent_footer %}{% endblock %} {% block footer %}{% endblock %} {{ include_footer }} diff --git a/docker/neutron/neutron-networking-sfc-agent/extend_start.sh b/docker/neutron/neutron-sfc-agent/extend_start.sh similarity index 100% rename from docker/neutron/neutron-networking-sfc-agent/extend_start.sh rename to docker/neutron/neutron-sfc-agent/extend_start.sh diff --git a/kolla/common/config.py b/kolla/common/config.py index 5985c2b3d6..ccf70f24d5 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -241,7 +241,7 @@ SOURCES = { 'type': 'url', 'location': ('http://tarballs.openstack.org/neutron-lbaas/' 'neutron-lbaas-master.tar.gz')}, - 'neutron-networking-sfc-agent': { + 'neutron-sfc-agent': { 'type': 'url', 'location': ('http://tarballs.openstack.org/networking-sfc/' 'networking-sfc-master.tar.gz')}, diff --git a/releasenotes/notes/add-networking-sfc-62ae433ed7aa4e33.yaml b/releasenotes/notes/add-networking-sfc-62ae433ed7aa4e33.yaml new file mode 100644 index 0000000000..b5e5073ba6 --- /dev/null +++ b/releasenotes/notes/add-networking-sfc-62ae433ed7aa4e33.yaml @@ -0,0 +1,5 @@ +--- +features: + - Add neutron Service Function Chaining (sfc) support. Service Function + Chaining is a mechanism for overriding the basic destination based + forwarding that is typical of IP networks diff --git a/tests/test_build.py b/tests/test_build.py index 2c8fd9032a..96e67e794b 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -66,7 +66,7 @@ class BuildTest(object): class BuildTestCentosBinary(BuildTest, base.BaseTestCase): excluded_images = ["kuryr", - "neutron-networking-sfc-agent", + "neutron-sfc-agent", "senlin-base", "vmtp", "watcher-base", @@ -94,7 +94,7 @@ class BuildTestUbuntuBinary(BuildTest, base.BaseTestCase): # package, just add neutron-lbaas-agent into the exclude_image. Once they # fix it, this should be reverted. excluded_images = ["kuryr", - "neutron-networking-sfc-agent", + "neutron-sfc-agent", "neutron-lbaas-agent", "senlin-base", "vmtp", @@ -121,7 +121,7 @@ class BuildTestUbuntuSource(BuildTest, base.BaseTestCase): class BuildTestOracleLinuxBinary(BuildTest, base.BaseTestCase): excluded_images = ["kuryr", - "neutron-networking-sfc-agent", + "neutron-sfc-agent", "senlin-base", "vmtp", "watcher-base",