Merge "[queens] Smooth out OVN backend"
diff --git a/.kitchen.travis.yml b/.kitchen.travis.yml
new file mode 100644
index 0000000..f847543
--- /dev/null
+++ b/.kitchen.travis.yml
@@ -0,0 +1,6 @@
+suites:
+
+  - name: <%= ENV['SUITE'] %>
+    provisioner:
+      pillars-from-files:
+        neutron.sls: tests/pillar/<%= ENV['SUITE'] %>.sls
diff --git a/.travis.yml b/.travis.yml
index 2d0633e..31b7e26 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -83,6 +83,7 @@
     - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2016.3 SUITE=gateway-legacy-fwaas-v1
     - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-xenial-salt-2017.7 SUITE=gateway-legacy-fwaas-v1
 #   - PLATFORM=epcim/salt-formulas:saltstack-ubuntu-bionic-salt-2017.7 SUITE=gateway-legacy-fwaas-v1
+
 before_script:
   - set -o pipefail
   - make test | tail
diff --git a/README.rst b/README.rst
index dd03ed1..e659bde 100644
--- a/README.rst
+++ b/README.rst
@@ -27,6 +27,7 @@
         rpc_workers: 2
         rpc_state_report_workers: 2
         root_helper_daemon: false
+        dhcp_lease_duration: 600
         bind:
           address: 172.20.0.1
           port: 9696
@@ -207,6 +208,7 @@
       gateway:
         enabled: True
         version: mitaka
+        dhcp_lease_duration: 600
         message_queue:
           engine: rabbitmq
           host: 127.0.0.1
diff --git a/neutron/compute.sls b/neutron/compute.sls
index 0dc1344..2eefb6a 100644
--- a/neutron/compute.sls
+++ b/neutron/compute.sls
@@ -88,6 +88,21 @@
 - neutron.fwaas
 {%- endif %}
 
+{%- if not grains.get('noservices', False) %}
+# NOTE(mpolenchuk): haproxy is used as a replacement for
+# neutron-ns-metadata-proxy Python implementation starting from Pike
+haproxy:
+  {%- if grains['saltversioninfo'] < [2017,7] %}
+  module.run:
+  - name: service.mask
+  - m_name: haproxy
+  {%- else %}
+  service.masked:
+  {%- endif %}
+  - prereq:
+    - pkg: neutron_dvr_packages
+{%- endif %}
+
 neutron_dvr_packages:
   pkg.installed:
   - names:
diff --git a/neutron/files/pike/neutron-generic.conf.Debian b/neutron/files/pike/neutron-generic.conf.Debian
index a2083e0..fe9feae 100644
--- a/neutron/files/pike/neutron-generic.conf.Debian
+++ b/neutron/files/pike/neutron-generic.conf.Debian
@@ -87,7 +87,7 @@
 # DHCP lease duration (in seconds). Use -1 to tell dnsmasq to use infinite
 # lease times. (integer value)
 #dhcp_lease_duration = 86400
-dhcp_lease_duration = 600
+dhcp_lease_duration = {{ neutron.dhcp_lease_duration|default('600') }}
 
 # Domain to use for building the hostnames (string value)
 #dns_domain = openstacklocal
diff --git a/neutron/files/pike/neutron-server.conf.Debian b/neutron/files/pike/neutron-server.conf.Debian
index cc75da5..963aa65 100644
--- a/neutron/files/pike/neutron-server.conf.Debian
+++ b/neutron/files/pike/neutron-server.conf.Debian
@@ -112,7 +112,7 @@
 # DHCP lease duration (in seconds). Use -1 to tell dnsmasq to use infinite
 # lease times. (integer value)
 #dhcp_lease_duration = 86400
-dhcp_lease_duration = 600
+dhcp_lease_duration = {{ server.dhcp_lease_duration|default('600') }}
 
 # Domain to use for building the hostnames (string value)
 #dns_domain = openstacklocal
diff --git a/neutron/files/queens/neutron-generic.conf.Debian b/neutron/files/queens/neutron-generic.conf.Debian
index 1456659..9c985a5 100644
--- a/neutron/files/queens/neutron-generic.conf.Debian
+++ b/neutron/files/queens/neutron-generic.conf.Debian
@@ -82,7 +82,7 @@
 # DHCP lease duration (in seconds). Use -1 to tell dnsmasq to use infinite
 # lease times. (integer value)
 #dhcp_lease_duration = 86400
-dhcp_lease_duration = 600
+dhcp_lease_duration = {{ neutron.dhcp_lease_duration|default('600') }}
 
 # Domain to use for building the hostnames (string value)
 #dns_domain = openstacklocal
diff --git a/neutron/files/queens/neutron-server.conf.Debian b/neutron/files/queens/neutron-server.conf.Debian
index 9b4534f..5a5fb50 100644
--- a/neutron/files/queens/neutron-server.conf.Debian
+++ b/neutron/files/queens/neutron-server.conf.Debian
@@ -100,7 +100,7 @@
 # DHCP lease duration (in seconds). Use -1 to tell dnsmasq to use infinite
 # lease times. (integer value)
 #dhcp_lease_duration = 86400
-dhcp_lease_duration = 600
+dhcp_lease_duration = {{ server.dhcp_lease_duration|default('600') }}
 
 # Domain to use for building the hostnames (string value)
 #dns_domain = openstacklocal
diff --git a/neutron/gateway.sls b/neutron/gateway.sls
index 9c884ce..1d2170e 100644
--- a/neutron/gateway.sls
+++ b/neutron/gateway.sls
@@ -10,6 +10,21 @@
   pkg.installed:
   - names: {{ gateway.pkgs }}
 
+{%- if not grains.get('noservices', False) %}
+# NOTE(mpolenchuk): haproxy is used as a replacement for
+# neutron-ns-metadata-proxy Python implementation starting from Pike
+haproxy:
+  {%- if grains['saltversioninfo'] < [2017,7] %}
+  module.run:
+  - name: service.mask
+  - m_name: haproxy
+  {%- else %}
+  service.masked:
+  {%- endif %}
+  - prereq:
+    - pkg: neutron_gateway_packages
+{%- endif %}
+
 {%- if pillar.neutron.server is not defined %}
 
 /etc/neutron/neutron.conf:
diff --git a/tests/pillar/compute_dhcp.sls b/tests/pillar/compute_dhcp.sls
index 6dcf31b..b19b0d9 100644
--- a/tests/pillar/compute_dhcp.sls
+++ b/tests/pillar/compute_dhcp.sls
@@ -1,6 +1,7 @@
 neutron:
   compute:
     agent_mode: legacy
+    dhcp_lease_duration: 86400
     backend:
       engine: ml2
       tenant_network_types: "flat,vxlan"
diff --git a/tests/pillar/control_cluster.sls b/tests/pillar/control_cluster.sls
index 2b4e2af..1a1d30b 100644
--- a/tests/pillar/control_cluster.sls
+++ b/tests/pillar/control_cluster.sls
@@ -8,6 +8,7 @@
     version: liberty
     api_workers: 2
     rpc_workers: 2
+    dhcp_lease_duration: 86400
     backend:
       engine: contrail
       #contrail_discovery_host
diff --git a/tests/pillar/gateway_legacy.sls b/tests/pillar/gateway_legacy.sls
index 66e99fa..6ce2ba0 100644
--- a/tests/pillar/gateway_legacy.sls
+++ b/tests/pillar/gateway_legacy.sls
@@ -1,6 +1,7 @@
 neutron:
   gateway:
     agent_mode: legacy
+    dhcp_lease_duration: 86400
     backend:
       engine: ml2
       tenant_network_types: "flat,vxlan"