Merge "Add support for n-g-s ml2 plugin"
diff --git a/README.rst b/README.rst
index 86afc25..2812d40 100644
--- a/README.rst
+++ b/README.rst
@@ -535,6 +535,34 @@
             ovs:
               driver: openvswitch
 
+Configuring networking-generic-switch ml2 plugin used for
+baremetal integration:
+
+.. code-block:: yaml
+
+    neutron:
+      server:
+        backend:
+          mechanism:
+            ngs:
+              driver: genericswitch
+        n_g_s:
+          enabled: true
+          coordination:
+            enabled: true
+            backend_url: "etcd3+http://1.2.3.4:2379"
+          devices:
+            s1brbm:
+              options:
+                device_type:
+                  value: netmiko_ovs_linux
+                ip:
+                  value: 1.2.3.4
+                username:
+                  value: ngs_ovs_manager
+                password:
+                  value: password
+
 Network Node:
 
 .. code-block:: yaml
diff --git a/neutron/files/pike/neutron-server.conf b/neutron/files/pike/neutron-server.conf
index 648faae..5fd1acd 100644
--- a/neutron/files/pike/neutron-server.conf
+++ b/neutron/files/pike/neutron-server.conf
@@ -2337,3 +2337,7 @@
 {%- if server.backend.ovsdb_connection is defined %}
 ovsdb_connection = {{ server.backend.ovsdb_connection }}
 {%- endif %}
+
+{% if server.n_g_s is defined  -%}
+{%- include "neutron/files/pike/plugins/_n_g_s.conf" %}
+{% endif %}
diff --git a/neutron/files/pike/plugins/_n_g_s.conf b/neutron/files/pike/plugins/_n_g_s.conf
new file mode 100644
index 0000000..8eb2091
--- /dev/null
+++ b/neutron/files/pike/plugins/_n_g_s.conf
@@ -0,0 +1,19 @@
+{%- if server.n_g_s.enabled|default(False) %}
+  {%- if server.n_g_s.get('coordination', {}).get('enabled') %}
+[ngs_coordination]
+backend_url = {{ server.n_g_s.coordination.backend_url }}
+    {%- if server.n_g_s.coordination.acquire_timeout is defined %}
+acquire_timeout = {{ server.n_g_s.coordination.acquire_timeout }}
+    {%- endif %}
+  {%- endif %}
+  {%- for device_name, device in server.n_g_s.devices.iteritems() %}
+    {%- if device.get('enabled', True) %}
+[genericswitch:{{ device_name }}]
+      {%- for opt_name, opt in device.options.iteritems() %}
+        {%- if opt.get('enabled', True) %}
+{{ opt.get('name', opt_name) }} = {{ opt.value }}
+        {%- endif %}
+      {%- endfor %}
+    {%- endif %}
+  {%- endfor %}
+{%- endif %}
diff --git a/neutron/files/queens/neutron-server.conf b/neutron/files/queens/neutron-server.conf
index e057afd..bec05f0 100644
--- a/neutron/files/queens/neutron-server.conf
+++ b/neutron/files/queens/neutron-server.conf
@@ -584,3 +584,7 @@
 {% if server.sfc is defined -%}
 {%- include "neutron/files/queens/plugins/sfc.conf" %}
 {% endif %}
+
+{% if server.n_g_s is defined  -%}
+{%- include "neutron/files/queens/plugins/_n_g_s.conf" %}
+{% endif %}
diff --git a/neutron/files/queens/plugins/_n_g_s.conf b/neutron/files/queens/plugins/_n_g_s.conf
new file mode 100644
index 0000000..8eb2091
--- /dev/null
+++ b/neutron/files/queens/plugins/_n_g_s.conf
@@ -0,0 +1,19 @@
+{%- if server.n_g_s.enabled|default(False) %}
+  {%- if server.n_g_s.get('coordination', {}).get('enabled') %}
+[ngs_coordination]
+backend_url = {{ server.n_g_s.coordination.backend_url }}
+    {%- if server.n_g_s.coordination.acquire_timeout is defined %}
+acquire_timeout = {{ server.n_g_s.coordination.acquire_timeout }}
+    {%- endif %}
+  {%- endif %}
+  {%- for device_name, device in server.n_g_s.devices.iteritems() %}
+    {%- if device.get('enabled', True) %}
+[genericswitch:{{ device_name }}]
+      {%- for opt_name, opt in device.options.iteritems() %}
+        {%- if opt.get('enabled', True) %}
+{{ opt.get('name', opt_name) }} = {{ opt.value }}
+        {%- endif %}
+      {%- endfor %}
+    {%- endif %}
+  {%- endfor %}
+{%- endif %}