Add OpenDaylight Neutron plugin support

This patch adds a new service "opendaylight", configures neutron
to use ml2 opendaylight plugin, configures ovs to be managed by
opendaylight.

Co-Authored-By: Elena Ezhova <eezhova@mirantis.com>
Change-Id: I0125075440d788437672b1980473e8a5ecffd29e
This commit is contained in:
Oleg Bondarev 2016-11-16 09:21:40 +00:00
parent f4f30a276f
commit ec529bd594
10 changed files with 122 additions and 4 deletions

View File

@ -19,6 +19,7 @@ RUN apt-get update \
{{ copy_sources("projectcalico/libcalico", "/libcalico") }}
{{ copy_sources("projectcalico/calico", "/calico") }}
{{ copy_sources("openstack/networking-calico", "/networking-calico") }}
{{ copy_sources("openstack/networking-odl", "/networking-odl") }}
RUN cd /neutron \
&& useradd --user-group neutron \
@ -43,6 +44,8 @@ RUN /var/lib/microservices/venv/bin/pip install --upgrade /libcalico \
&& /var/lib/microservices/venv/bin/pip install --upgrade /calico \
&& rm -rf /calico \
&& /var/lib/microservices/venv/bin/pip install --upgrade /networking-calico \
&& rm -rf /networking-calico
&& rm -rf /networking-calico \
&& /var/lib/microservices/venv/bin/pip install --upgrade /networking-odl \
&& rm -rf /networking-odl
ENV PATH /var/lib/microservices/venv/bin:$PATH

View File

@ -60,6 +60,19 @@ configs:
ovs_db:
loglevel: "info"
opendaylight:
api_port:
cont: 8080
ovs_port:
cont: 6640
openflow_port1:
cont: 6633
openflow_port2:
cont: 6653
dlux_port:
cont: 8181
username: admin
password: password
sources:
openstack/neutron:
@ -74,6 +87,9 @@ sources:
openstack/networking-calico:
git_url: https://github.com/openstack/networking-calico.git
git_ref: master
openstack/networking-odl:
git_url: https://github.com/openstack/networking-odl.git
git_ref: stable/newton
versions:
ovs_version: "system"

View File

@ -15,6 +15,8 @@ mechanism_drivers = openvswitch,l2population
mechanism_drivers = linuxbridge,l2population
{% elif neutron.plugin_agent == "calico" %}
mechanism_drivers = calico
{% elif neutron.plugin_agent == "opendaylight" %}
mechanism_drivers = opendaylight, logger
{% endif %}
extension_drivers = port_security{% if neutron.enable_qos %},qos{% endif %}
@ -76,3 +78,11 @@ local_ip = {{ network_topology["private"]["address"] }}
etcd_host = {{ neutron.calico.etcd_host }}
etcd_port = {{ neutron.calico.etcd_port }}
{% endif %}
{% if neutron.plugin_agent == "opendaylight" %}
[ml2_odl]
port_binding_controller = network-topology
password = {{ opendaylight.password }}
username = {{ opendaylight.username }}
url = http://{{ address('opendaylight', port=opendaylight.api_port, with_scheme=True) }}/controller/nb/v2/neutron
{% endif %}

View File

@ -13,7 +13,7 @@ endpoint_type = internalURL
metadata_proxy_socket = /var/lib/neutron/ccp/metadata_proxy
{% if neutron.plugin_agent == "openvswitch" %}
{% if neutron.plugin_agent in ["openvswitch", "opendaylight"] %}
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
{% elif neutron.plugin_agent == "linuxbridge" %}
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
@ -22,7 +22,7 @@ interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
allow_overlapping_ips = true
dhcp_agents_per_network = 2
core_plugin = {{ neutron.core_plugin }}
service_plugins = router{% if neutron.enable_lbaas %},neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2{% endif %}{% if neutron.enable_qos %},qos{% endif %}
service_plugins = {% if neutron.plugin_agent == "opendaylight" %}odl-router{% else %}router{% endif %}{% if neutron.enable_lbaas %},neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2{% endif %}{% if neutron.enable_qos %},qos{% endif %}
# Enable HA mode for virtual routers. (boolean value)

View File

@ -0,0 +1,9 @@
#!/bin/bash -ex
odl_port={{ opendaylight.ovs_port.cont }}
odl_boot_wait_url=restconf/operational/network-topology:network-topology/topology/netvirt:1
odl_boot_wait_timeout=60
odl_retry_check_interval=5
curl -o /dev/null --fail --silent --head -u admin:admin http://127.0.0.1:${odl_port}/${odl_boot_wait_url}

View File

@ -0,0 +1,20 @@
#!/bin/bash
set -e
odl_ip={{ address('opendaylight') | gethostbyname }}
odl_port={{ opendaylight.ovs_port.cont }}
ovs-vsctl set-manager tcp:$odl_ip:$odl_port
ovs_id=$(ovs-vsctl get Open_vSwitch . _uuid)
local_ip="{{ network_topology["private"]["address"] }}"
ovs-vsctl set Open_vSwitch $ovs_id other_config:local_ip=$local_ip
provider_mappings=
{%- for net in neutron.physnets -%}
{%- if not loop.first %},{% endif -%}
{{ net.name }}:{{ net.interface }}
{%- endfor %}
ovs-vsctl set Open_vSwitch $ovs_id other_config:provider_mappings="$provider_mappings"

View File

@ -1,6 +1,9 @@
dsl_version: 0.4.0
service:
name: neutron-server
# {% if neutron.plugin_agent == "opendaylight" %}
hostNetwork: true
# {% endif %}
ports:
- {{ neutron.server_port }}
annotations:
@ -61,6 +64,11 @@ service:
files:
- neutron.conf
- ml2-conf.ini
# {% if neutron.plugin_agent == "opendaylight" %}
dependencies:
- openvswitch-vswitchd
# {% endif %}
files:
neutron.conf:
path: /etc/neutron/neutron.conf

28
service/opendaylight.yaml Normal file
View File

@ -0,0 +1,28 @@
dsl_version: 0.1.0
service:
name: opendaylight
ports:
- {{ opendaylight.api_port }}
- {{ opendaylight.ovs_port }}
- {{ opendaylight.openflow_port1 }}
- {{ opendaylight.openflow_port2 }}
- {{ opendaylight.dlux_port }}
containers:
- name: opendaylight
image: opendaylight
probes:
readiness: /usr/local/bin/odl-wait-boot.sh
volumes:
- name: ovs-socket
type: host
path: /run/openvswitch
daemon:
command: ./bin/karaf
files:
- odl-wait-boot.sh
files:
odl-wait-boot.sh:
path: /usr/local/bin/odl-wait-boot.sh
content: odl-wait-boot.sh.j2
perm: "0755"

View File

@ -14,7 +14,7 @@ service:
- name: ovs-bootstrap
command: /opt/ccp/bin/openvswitch-db-bootstrap.sh
daemon:
command: "/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:{{ ovs_db.loglevel }} --remote=punix:/run/openvswitch/db.sock"
command: "/usr/sbin/ovsdb-server /etc/openvswitch/conf.db -vconsole:{{ ovs_db.loglevel }} --remote=punix:/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options"
files:
- openvswitch-db-bootstrap.sh
files:

View File

@ -7,6 +7,12 @@ service:
- name: openvswitch-vswitchd
image: openvswitch-vswitchd
privileged: true
# {% if neutron.plugin_agent == "opendaylight" %}
probes:
readiness:
type: exec
command: "ovs-vsctl list Bridge | grep br-int > /dev/null"
# {% endif %}
volumes:
- name: ovs-socket
type: host
@ -24,20 +30,38 @@ service:
dependencies:
- vswitchd-bootstrap
- openvswitch-db:local
# {% if neutron.plugin_agent == "opendaylight" %}
- opendaylight
# {% endif %}
# {% if neutron.plugin_agent != "opendaylight" %}
# {% for net in neutron.physnets %}
- name: vswitchd-setup-ovs-bridge-{{ net.name }}
command: /usr/local/bin/ovs-ensure-configured.sh {{ net.bridge_name }} {{ net.interface }}
dependencies:
- vswitchd-check-ovs-db
# {% endfor %}
# {% endif %}
daemon:
command: /usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock --mlockall
dependencies:
- openvswitch-db:local
# {% if neutron.plugin_agent == "opendaylight" %}
- opendaylight
# {% endif %}
files:
- ovs-ensure-configured.sh
# {% if neutron.plugin_agent == "opendaylight" %}
- ovs-set-managed-by-odl.sh
post:
- name: ovs-set-managed-by-odl
command: /usr/local/bin/ovs-set-managed-by-odl.sh
# {% endif %}
files:
ovs-ensure-configured.sh:
path: /usr/local/bin/ovs-ensure-configured.sh
content: ovs-ensure-configured.sh
perm: "0755"
ovs-set-managed-by-odl.sh:
path: /usr/local/bin/ovs-set-managed-by-odl.sh
content: ovs-set-managed-by-odl.sh.j2
perm: "0755"