Merge "Add prometheus main dashboard"
diff --git a/README.rst b/README.rst
index 2047af9..4a5787a 100644
--- a/README.rst
+++ b/README.rst
@@ -157,7 +157,6 @@
     neutron:
       server:
         version: mitaka
-        plugin: ml2
         bind:
           address: 172.20.0.1
           port: 9696
@@ -267,7 +266,6 @@
     neutron:
       server:
         version: mitaka
-        plugin: ml2
         bind:
           address: 172.20.0.1
           port: 9696
@@ -374,7 +372,6 @@
     neutron:
       server:
         version: mitaka
-        plugin: ml2
         bind:
           address: 172.20.0.1
           port: 9696
@@ -561,7 +558,6 @@
     neutron:
       server:
         version: mitaka
-        plugin: ml2
         ...
         global_physnet_mtu: 9000
         l3_ha: False
@@ -583,7 +579,6 @@
     neutron:
       compute:
         version: mitaka
-        plugin: ml2
         ...
         dvr: True
         agent_mode: dvr
@@ -613,7 +608,6 @@
     neutron:
       compute:
         version: mitaka
-        plugin: ml2
         dpdk: True
         backend:
           engine: ml2
@@ -629,7 +623,6 @@
     neutron:
       server:
         version: mitaka
-        plugin: ml2
         backend:
           engine: ml2
           ...
@@ -642,7 +635,6 @@
     neutron:
       compute:
         version: mitaka
-        plugin: ml2
         ...
         backend:
           engine: ml2
@@ -678,7 +670,6 @@
 
     neutron:
       server:
-        plugin: contrail
         backend:
           engine: contrail
           host: contrail_discovery_host
@@ -953,6 +944,19 @@
           Instance port in the stated subnet will be associated with the dynamically generated floating IP.
 
 
+
+Enable Neutron extensions (QoS, DNS, etc.)
+------------------------------------------
+.. code-block:: yaml
+
+    neutron:
+      server:
+        backend:
+          extension:
+            - dns
+            - qos
+
+
 Documentation and Bugs
 ======================
 
diff --git a/metadata/service/control/single.yml b/metadata/service/control/single.yml
index 12a603c..a47f680 100644
--- a/metadata/service/control/single.yml
+++ b/metadata/service/control/single.yml
@@ -8,7 +8,6 @@
   neutron:
     server:
       enabled: true
-      plugin: ml2
       fwaas: false
       dns_domain: novalocal
       tunnel_type: vxlan
diff --git a/neutron/compute.sls b/neutron/compute.sls
index bb80f21..6829780 100644
--- a/neutron/compute.sls
+++ b/neutron/compute.sls
@@ -42,7 +42,7 @@
     - file: /etc/neutron/plugins/ml2/openvswitch_agent.ini
     - file: /etc/neutron/plugins/ml2/sriov_agent.ini
     {%- if compute.message_queue.get('ssl',{}).get('enabled', False) %}
-    - file: rabbitmq_ca
+    - file: rabbitmq_ca_neutron_compute
     {%- endif %}
 
 {% endif %}
@@ -74,7 +74,7 @@
       - file: /etc/neutron/fwaas_driver.ini
       {% endif %}
       {%- if compute.message_queue.get('ssl',{}).get('enabled', False) %}
-      - file: rabbitmq_ca
+      - file: rabbitmq_ca_neutron_compute
       {%- endif %}
     - require:
       - pkg: neutron_dvr_packages
@@ -114,12 +114,12 @@
     - file: /etc/neutron/neutron.conf
     - file: /etc/neutron/plugins/ml2/openvswitch_agent.ini
     {%- if compute.message_queue.get('ssl',{}).get('enabled', False) %}
-    - file: rabbitmq_ca
+    - file: rabbitmq_ca_neutron_compute
     {%- endif %}
 
 
 {%- if compute.message_queue.get('ssl',{}).get('enabled', False) %}
-rabbitmq_ca:
+rabbitmq_ca_neutron_compute:
 {%- if compute.message_queue.ssl.cacert is defined %}
   file.managed:
     - name: {{ compute.message_queue.ssl.cacert_file }}
diff --git a/neutron/files/juno/neutron-server b/neutron/files/juno/neutron-server
index 9b06503..3c91959 100644
--- a/neutron/files/juno/neutron-server
+++ b/neutron/files/juno/neutron-server
@@ -7,10 +7,10 @@
 # neutron.conf
 #NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini"
 
-{%- if server.plugin == "ml2" %}
+{%- if server.backend.engine == "ml2" %}
 NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/ml2/ml2_conf.ini"
 {%- endif %}
 
-{%- if server.plugin == "contrail" %}
+{%- if server.backend.engine == "contrail" %}
 NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/opencontrail/ContrailPlugin.ini"
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/neutron/files/ocata/ml2_conf.ini b/neutron/files/ocata/ml2_conf.ini
index 0d48951..5ecafe3 100644
--- a/neutron/files/ocata/ml2_conf.ini
+++ b/neutron/files/ocata/ml2_conf.ini
@@ -137,7 +137,10 @@
 # neutron.ml2.extension_drivers namespace. For example: extension_drivers =
 # port_security,qos (list value)
 #extension_drivers =
-extension_drivers = port_security{% if server.get('qos', 'True') %},qos{% endif %}
+{%- set tmp_ext_list = server.backend.get('extension', []) %}
+{%- do tmp_ext_list.append('port_security') if 'port_security' not in tmp_ext_list %}
+{%- do tmp_ext_list.append('qos') if server.get('qos', 'True') and 'qos' not in tmp_ext_list %}
+extension_drivers={{ tmp_ext_list|join(',') }}
 
 # Maximum size of an IP packet (MTU) that can traverse the underlying physical
 # network infrastructure without fragmentation when using an overlay/tunnel
diff --git a/neutron/files/ocata/openvswitch_agent.ini b/neutron/files/ocata/openvswitch_agent.ini
index 00c33b4..654fc76 100644
--- a/neutron/files/ocata/openvswitch_agent.ini
+++ b/neutron/files/ocata/openvswitch_agent.ini
@@ -195,9 +195,9 @@
 #agent_type = Open vSwitch agent
 
 # Extensions list to use (list value)
-{% if neutron.get('qos', 'True') %}
-extensions = qos
-{% endif %}
+{%- set tmp_ext_list = neutron.backend.get('extension', []) %}
+{%- do tmp_ext_list.append('qos') if neutron.get('qos', 'True') and 'qos' not in tmp_ext_list %}
+extensions={{ tmp_ext_list|join(',') }}
 
 [ovs]
 
diff --git a/neutron/files/ocata/sriov_agent.ini b/neutron/files/ocata/sriov_agent.ini
index eebd662..9ba9c1a 100644
--- a/neutron/files/ocata/sriov_agent.ini
+++ b/neutron/files/ocata/sriov_agent.ini
@@ -122,9 +122,9 @@
 #
 
 # Extensions list to use (list value)
-{% if neutron.get('qos', 'True') %}
-extensions = qos
-{% endif %}
+{%- set tmp_ext_list = neutron.backend.get('extension', []) %}
+{%- do tmp_ext_list.append('qos') if neutron.get('qos', 'True') and 'qos' not in tmp_ext_list %}
+extensions={{ tmp_ext_list|join(',') }}
 
 
 [sriov_nic]
diff --git a/neutron/gateway.sls b/neutron/gateway.sls
index 96d7e9f..81513d8 100644
--- a/neutron/gateway.sls
+++ b/neutron/gateway.sls
@@ -63,12 +63,12 @@
     - file: /etc/neutron/fwaas_driver.ini
     {%- endif %}
     {%- if gateway.message_queue.get('ssl',{}).get('enabled', False) %}
-    - file: rabbitmq_ca
+    - file: rabbitmq_ca_neutron_gateway
     {%- endif %}
 
 
 {%- if gateway.message_queue.get('ssl',{}).get('enabled', False) %}
-rabbitmq_ca:
+rabbitmq_ca_neutron_gateway:
 {%- if gateway.message_queue.ssl.cacert is defined %}
   file.managed:
     - name: {{ gateway.message_queue.ssl.cacert_file }}
diff --git a/neutron/map.jinja b/neutron/map.jinja
index 80aa94d..eef262f 100644
--- a/neutron/map.jinja
+++ b/neutron/map.jinja
@@ -92,22 +92,3 @@
         'error_log_rate': 0.2,
     },
 }, grain='os_family', merge=salt['pillar.get']('neutron:monitoring')) %}
-
-{%- if pillar.neutron.server is defined %}
-
-{%- set tmp_server = pillar.neutron.server %}
-
-{%- if not tmp_server.backend is defined %}
-
-{%- if pillar.opencontrail is defined and tmp_server.plugin == "contrail" %}
-
-{%- from "opencontrail/map.jinja" import config with context %}
-
-{%- set backend = {'engine': tmp_server.plugin, 'host': config.discovery.host, 'token': config.identity.token, 'user': config.identity.user, 'password': config.identity.password, 'tenant': config.identity.tenant} %}
-{%- set tmp = server.update({'backend': backend}) %}
-
-{%- endif %}
-
-{%- endif %}
-
-{%- endif %}
diff --git a/neutron/meta/prometheus.yml b/neutron/meta/prometheus.yml
index 7b90ecb..28c2957 100644
--- a/neutron/meta/prometheus.yml
+++ b/neutron/meta/prometheus.yml
@@ -15,6 +15,17 @@
         summary: "Endpoint check for '{{ $labels.service }}' is down"
         description: >-
             Endpoint check for '{{ $labels.service }}' is down for 2 minutes
+    NeutronAPIServiceDown:
+      if: >-
+        http_response_status{service=~"neutron-api"} == 0
+      for: 2m
+      labels:
+        severity: down
+        service: "{{ $labels.service }}"
+      annotations:
+        summary: "HTTP check for '{{ $labels.service }}' down"
+        description: >-
+            The HTTP check for '{{ $labels.service }}' is down on {{ $labels.host }} for 2 minutes.
 {%- endraw %}
 {%- if server.get('backend', {}).engine is defined and server.backend.engine == "ml2" %}
 {%- raw %}
diff --git a/neutron/server.sls b/neutron/server.sls
index eff9fb8..79e5aba 100644
--- a/neutron/server.sls
+++ b/neutron/server.sls
@@ -67,7 +67,7 @@
   - watch:
     - file: /etc/neutron/neutron.conf
     {%- if server.message_queue.get('ssl',{}).get('enabled', False) %}
-    - file: rabbitmq_ca
+    - file: rabbitmq_ca_neutron_server
     {%- endif %}
 
 {%- endif %}
@@ -80,6 +80,8 @@
   - template: jinja
   - require:
     - pkg: neutron_server_packages
+  - watch_in:
+    - service: neutron_server_services
 
 ml2_plugin_link:
   cmd.run:
@@ -218,7 +220,7 @@
   - watch:
     - file: /etc/neutron/neutron.conf
     {%- if server.message_queue.get('ssl',{}).get('enabled', False) %}
-    - file: rabbitmq_ca
+    - file: rabbitmq_ca_neutron_server
     {%- endif %}
 
 {%- if grains.get('virtual_subtype', None) == "Docker" %}
@@ -234,7 +236,7 @@
 
 
 {%- if server.message_queue.get('ssl',{}).get('enabled', False) %}
-rabbitmq_ca:
+rabbitmq_ca_neutron_server:
 {%- if server.message_queue.ssl.cacert is defined %}
   file.managed:
     - name: {{ server.message_queue.ssl.cacert_file }}
diff --git a/tests/pillar/control_dvr.sls b/tests/pillar/control_dvr.sls
index a6fc8b3..5031810 100644
--- a/tests/pillar/control_dvr.sls
+++ b/tests/pillar/control_dvr.sls
@@ -44,7 +44,6 @@
       port: 5672
       user: openstack
       virtual_host: /openstack
-    plugin: ml2
     version: mitaka
     policy:
       create_subnet: 'rule:admin_or_network_owner'
diff --git a/tests/pillar/control_fwaas_v1.sls b/tests/pillar/control_fwaas_v1.sls
index 5311d2f..c39f05c 100644
--- a/tests/pillar/control_fwaas_v1.sls
+++ b/tests/pillar/control_fwaas_v1.sls
@@ -45,7 +45,6 @@
       port: 5672
       user: openstack
       virtual_host: /openstack
-    plugin: ml2
     policy:
       create_subnet: 'rule:admin_or_network_owner'
       'get_network:queue_id': 'rule:admin_only'
diff --git a/tests/pillar/control_lbaas_octavia.sls b/tests/pillar/control_lbaas_octavia.sls
index 5209b2d..65b0318 100644
--- a/tests/pillar/control_lbaas_octavia.sls
+++ b/tests/pillar/control_lbaas_octavia.sls
@@ -52,7 +52,6 @@
       port: 5672
       user: openstack
       virtual_host: /openstack
-    plugin: ml2
     policy:
       create_subnet: 'rule:admin_or_network_owner'
       'get_network:queue_id': 'rule:admin_only'
diff --git a/tests/pillar/control_nodvr.sls b/tests/pillar/control_nodvr.sls
index 0d18f6a..9597eee 100644
--- a/tests/pillar/control_nodvr.sls
+++ b/tests/pillar/control_nodvr.sls
@@ -44,7 +44,6 @@
       port: 5672
       user: openstack
       virtual_host: /openstack
-    plugin: ml2
     version: mitaka
     policy:
       create_subnet: 'rule:admin_or_network_owner'
diff --git a/tests/pillar/control_qos.sls b/tests/pillar/control_qos.sls
index 3c24ccf..9bed6b5 100644
--- a/tests/pillar/control_qos.sls
+++ b/tests/pillar/control_qos.sls
@@ -45,7 +45,6 @@
       port: 5672
       user: openstack
       virtual_host: /openstack
-    plugin: ml2
     version: ocata
     policy:
       create_subnet: 'rule:admin_or_network_owner'