Merge "Filter out OpenDaylight client on computes"
diff --git a/neutron/compute.sls b/neutron/compute.sls
index 418282d..e83a5b7 100644
--- a/neutron/compute.sls
+++ b/neutron/compute.sls
@@ -2,6 +2,36 @@
 {%- if compute.enabled %}
 
 {% if compute.backend.engine == "ml2" %}
+
+{% if compute.get('dhcp_agent_enabled', False) %}
+neutron_dhcp_agent_packages:
+  pkg.installed:
+  - names:
+    - neutron-dhcp-agent
+
+neutron_dhcp_agent:
+  service.running:
+    - enable: true
+    - names:
+      - neutron-dhcp-agent
+    - watch:
+      - file: /etc/neutron/dhcp_agent.ini
+    - require:
+      - pkg: neutron_dhcp_agent_packages
+
+/etc/neutron/dhcp_agent.ini:
+  file.managed:
+  - source: salt://neutron/files/{{ compute.version }}/dhcp_agent.ini
+  - template: jinja
+  - require:
+    - pkg: neutron_dhcp_agent_packages
+
+{% endif %}
+
+{%- if compute.opendaylight is defined %}
+include:
+  - .opendaylight.client
+{%- else %}
 neutron_compute_packages:
   pkg.installed:
   - names: {{ compute.pkgs }}
@@ -53,31 +83,6 @@
 
 {% endif %}
 
-{% if compute.get('dhcp_agent_enabled', False) %}
-neutron_dhcp_agent_packages:
-  pkg.installed:
-  - names:
-    - neutron-dhcp-agent
-
-neutron_dhcp_agent:
-  service.running:
-    - enable: true
-    - names:
-      - neutron-dhcp-agent
-    - watch:
-      - file: /etc/neutron/dhcp_agent.ini
-    - require:
-      - pkg: neutron_dhcp_agent_packages
-
-/etc/neutron/dhcp_agent.ini:
-  file.managed:
-  - source: salt://neutron/files/{{ compute.version }}/dhcp_agent.ini
-  - template: jinja
-  - require:
-    - pkg: neutron_dhcp_agent_packages
-
-{% endif %}
-
 {% if compute.dvr %}
 
 {%- if fwaas.get('enabled', False) %}
@@ -243,10 +248,7 @@
 {%- endif %}
 {%- endif %}
 
-{%- if compute.opendaylight is defined %}
-include:
-  - .opendaylight.client
-{%- endif %}
+{%- endif %}{# !OpenDaylight #}
 
 {%- elif compute.backend.engine == "ovn" %}
 
diff --git a/neutron/opendaylight/client.sls b/neutron/opendaylight/client.sls
index 57e6bcc..3c4a6a4 100644
--- a/neutron/opendaylight/client.sls
+++ b/neutron/opendaylight/client.sls
@@ -9,26 +9,21 @@
 
 {%- if not grains.get('noservices', False) %}
 
+{%- set ovs_manager = [neutron.opendaylight.ovsdb_odl_iface] %}
+{%- do ovs_manager.append(neutron.opendaylight.ovsdb_server_iface) if neutron.opendaylight.ovsdb_server_iface is defined %}
+
 ovs_set_manager:
   cmd.run:
-  - name: 'ovs-vsctl set-manager {{ neutron.opendaylight.ovsdb_server_iface }} {{ neutron.opendaylight.ovsdb_odl_iface }}'
-  - unless: 'ovs-vsctl get-manager | fgrep -x {{ neutron.opendaylight.ovsdb_odl_iface }}'
+  - name: 'ovs-vsctl set-manager {{ ovs_manager|join(' ') }}'
+  - unless: 'ovs-vsctl get-manager | fgrep -qx {{ neutron.opendaylight.ovsdb_odl_iface }}'
 
-ovs_set_tunnel_endpoint:
-  cmd.run:
-  - name: 'ovs-vsctl set Open_vSwitch . other_config:local_ip={{ neutron.opendaylight.tunnel_ip }}'
-  - unless: 'ovs-vsctl get Open_vSwitch . other_config | fgrep local_ip="{{ neutron.opendaylight.tunnel_ip }}"'
-
-{%- if neutron.opendaylight.provider_mappings is defined %}
-ovs_set_provider_mappings:
-  cmd.run:
-  - name: 'ovs-vsctl set Open_vSwitch . other_config:provider_mappings={{ neutron.opendaylight.provider_mappings }}'
-  - unless: 'ovs-vsctl get Open_vSwitch . other_config | fgrep provider_mappings="{{ neutron.opendaylight.provider_mappings }}"'
-{%- endif %}
+{%- set ovs_hostconfig = ['--noovs_dpdk'] %}
+{%- do ovs_hostconfig.append('--local_ip=' ~ neutron.opendaylight.tunnel_ip) if neutron.opendaylight.tunnel_ip is defined %}
+{%- do ovs_hostconfig.append('--bridge_mapping=' ~ neutron.opendaylight.provider_mappings) if neutron.opendaylight.provider_mappings is defined %}
 
 neutron_odl_ovs_hostconfig:
   cmd.run:
-  - name: 'neutron-odl-ovs-hostconfig --noovs_dpdk'
+  - name: 'neutron-odl-ovs-hostconfig {{ ovs_hostconfig|join(' ') }}'
   - require:
     - pkg: python-networking-odl