Revert "Refactor mechanism driver metadata"

This reverts commit 79ffa26858d682f404984175dc1ab93863a149ad.

Fixes PROD-14994

Change-Id: I8dc05999dd072b3249831a7ef01d07831e46db0f
diff --git a/README.rst b/README.rst
index 9fddb61..4a5787a 100644
--- a/README.rst
+++ b/README.rst
@@ -190,8 +190,8 @@
           tenant_network_types: "flat,vxlan"
           external_mtu: 9000
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Network Node
 
@@ -218,8 +218,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Compute Node
 
@@ -247,8 +247,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
         audit:
           enabled: false
 
@@ -299,8 +299,8 @@
           tenant_network_types= "flat,vxlan"
           external_mtu: 9000
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Network Node
 
@@ -328,8 +328,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Compute Node
 
@@ -353,8 +353,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Neutron VXLAN tenant networks with Network Nodes with DVR
 ---------------------------------------------------------
@@ -405,8 +405,8 @@
           tenant_network_types= "flat,vxlan"
           external_mtu: 9000
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Network Node
 
@@ -434,8 +434,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Compute Node
 
@@ -464,8 +464,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Sample Linux network configuration for DVR
 
@@ -569,8 +569,8 @@
           external_vlan_range: "100:200" # Does not have to be defined.
           external_mtu: 9000
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Compute node
 
@@ -587,8 +587,8 @@
           engine: ml2
           tenant_network_types: "flat,vlan" # Can be mixed flat,vlan,vxlan
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Advanced Neutron Features (DPDK, SR-IOV)
 
@@ -613,8 +613,8 @@
           engine: ml2
           ...
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Neutron OVS SR-IOV
 
@@ -627,9 +627,10 @@
           engine: ml2
           ...
           mechanism:
-            - openvswitch
-            - sriovnicswitch
-            - l2population
+            ovs:
+              driver: openvswitch
+            sriov:
+              driver: sriovnicswitch
 
     neutron:
       compute:
@@ -643,8 +644,8 @@
               devname: eth1
               physical_network: physnet3
           mechanism:
-            - openvswitch
-            - l2population
+            ovs:
+              driver: openvswitch
 
 Neutron with VLAN-aware-VMs
 
diff --git a/metadata/service/compute/single.yml b/metadata/service/compute/single.yml
index 3334e5d..377ff39 100644
--- a/metadata/service/compute/single.yml
+++ b/metadata/service/compute/single.yml
@@ -26,3 +26,6 @@
       backend:
         engine: ml2
         tenant_network_types: "flat,vxlan"
+        mechanism:
+          ovs:
+            driver: openvswitch
diff --git a/metadata/service/gateway/single.yml b/metadata/service/gateway/single.yml
index 076a923..1af2525 100644
--- a/metadata/service/gateway/single.yml
+++ b/metadata/service/gateway/single.yml
@@ -26,3 +26,6 @@
       backend:
         engine: ml2
         tenant_network_types: "flat,vxlan"
+        mechanism:
+          ovs:
+            driver: openvswitch
diff --git a/neutron/files/mitaka/ml2_conf.ini b/neutron/files/mitaka/ml2_conf.ini
index 6b8ac92..9a8e79c 100644
--- a/neutron/files/mitaka/ml2_conf.ini
+++ b/neutron/files/mitaka/ml2_conf.ini
@@ -96,7 +96,7 @@
 
 # An ordered list of networking mechanism driver entrypoints to be loaded from the neutron.ml2.mechanism_drivers namespace. (list value)
 #mechanism_drivers =openvswitch,l2population
-mechanism_drivers = {{ ','.join(server.backend.get('mechanism', [])) }}
+mechanism_drivers ={%- for backend_name, mechanism in server.backend.get('mechanism', {}).iteritems() %}{{ mechanism.driver }},{%- endfor %}l2population
 
 # An ordered list of extension driver entrypoints to be loaded from the neutron.ml2.extension_drivers namespace. For example:
 # extension_drivers = port_security,qos (list value)
diff --git a/neutron/files/newton/ml2_conf.ini b/neutron/files/newton/ml2_conf.ini
index 6b8ac92..9a8e79c 100644
--- a/neutron/files/newton/ml2_conf.ini
+++ b/neutron/files/newton/ml2_conf.ini
@@ -96,7 +96,7 @@
 
 # An ordered list of networking mechanism driver entrypoints to be loaded from the neutron.ml2.mechanism_drivers namespace. (list value)
 #mechanism_drivers =openvswitch,l2population
-mechanism_drivers = {{ ','.join(server.backend.get('mechanism', [])) }}
+mechanism_drivers ={%- for backend_name, mechanism in server.backend.get('mechanism', {}).iteritems() %}{{ mechanism.driver }},{%- endfor %}l2population
 
 # An ordered list of extension driver entrypoints to be loaded from the neutron.ml2.extension_drivers namespace. For example:
 # extension_drivers = port_security,qos (list value)
diff --git a/neutron/files/ocata/ml2_conf.ini b/neutron/files/ocata/ml2_conf.ini
index 50fcd2c..5ecafe3 100644
--- a/neutron/files/ocata/ml2_conf.ini
+++ b/neutron/files/ocata/ml2_conf.ini
@@ -131,7 +131,7 @@
 # An ordered list of networking mechanism driver entrypoints to be loaded from
 # the neutron.ml2.mechanism_drivers namespace. (list value)
 #mechanism_drivers =
-mechanism_drivers = {{ ','.join(server.backend.get('mechanism', [])) }}
+mechanism_drivers ={%- for backend_name, mechanism in server.backend.get('mechanism', {}).iteritems() %}{{ mechanism.driver }},{%- endfor %}l2population
 
 # An ordered list of extension driver entrypoints to be loaded from the
 # neutron.ml2.extension_drivers namespace. For example: extension_drivers =
diff --git a/tests/pillar/compute_dpdk.sls b/tests/pillar/compute_dpdk.sls
index 2fb1462..c56fb81 100644
--- a/tests/pillar/compute_dpdk.sls
+++ b/tests/pillar/compute_dpdk.sls
@@ -6,8 +6,8 @@
       engine: ml2
       tenant_network_types: "flat,vlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     external_access: false
diff --git a/tests/pillar/compute_dvr.sls b/tests/pillar/compute_dvr.sls
index a6a512e..8d5f7d5 100644
--- a/tests/pillar/compute_dvr.sls
+++ b/tests/pillar/compute_dvr.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: true
     enabled: true
     external_access: true
diff --git a/tests/pillar/compute_dvr_fwaas_v1.sls b/tests/pillar/compute_dvr_fwaas_v1.sls
index f483775..a4b86d2 100644
--- a/tests/pillar/compute_dvr_fwaas_v1.sls
+++ b/tests/pillar/compute_dvr_fwaas_v1.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: true
     enabled: true
     external_access: true
diff --git a/tests/pillar/compute_legacy.sls b/tests/pillar/compute_legacy.sls
index 194e431..154af25 100644
--- a/tests/pillar/compute_legacy.sls
+++ b/tests/pillar/compute_legacy.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     external_access: false
diff --git a/tests/pillar/compute_nonexternal_dvr.sls b/tests/pillar/compute_nonexternal_dvr.sls
index 54ad7b3..8ce0da1 100644
--- a/tests/pillar/compute_nonexternal_dvr.sls
+++ b/tests/pillar/compute_nonexternal_dvr.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: true
     enabled: true
     external_access: false
diff --git a/tests/pillar/compute_qos.sls b/tests/pillar/compute_qos.sls
index b8a2699..2122e00 100644
--- a/tests/pillar/compute_qos.sls
+++ b/tests/pillar/compute_qos.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     qos: true
diff --git a/tests/pillar/compute_qos_sriov.sls b/tests/pillar/compute_qos_sriov.sls
index 5d5fb39..7d4d4ab 100644
--- a/tests/pillar/compute_qos_sriov.sls
+++ b/tests/pillar/compute_qos_sriov.sls
@@ -9,8 +9,8 @@
           devname: eth1
           physical_network: physnet3
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     qos: true
diff --git a/tests/pillar/compute_sriov.sls b/tests/pillar/compute_sriov.sls
index 1e85ccd..f5a106f 100644
--- a/tests/pillar/compute_sriov.sls
+++ b/tests/pillar/compute_sriov.sls
@@ -9,8 +9,8 @@
           devname: eth1
           physical_network: physnet3
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     external_access: false
diff --git a/tests/pillar/control_dvr.sls b/tests/pillar/control_dvr.sls
index 2156670..5031810 100644
--- a/tests/pillar/control_dvr.sls
+++ b/tests/pillar/control_dvr.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
       tenant_network_types: flat,vxlan
     bind:
       address: 172.16.10.101
diff --git a/tests/pillar/control_fwaas_v1.sls b/tests/pillar/control_fwaas_v1.sls
index 88f91ca..c39f05c 100644
--- a/tests/pillar/control_fwaas_v1.sls
+++ b/tests/pillar/control_fwaas_v1.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
       tenant_network_types: flat,vxlan
     bind:
       address: 172.16.10.101
diff --git a/tests/pillar/control_lbaas_octavia.sls b/tests/pillar/control_lbaas_octavia.sls
index d96c3aa..65b0318 100644
--- a/tests/pillar/control_lbaas_octavia.sls
+++ b/tests/pillar/control_lbaas_octavia.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
       tenant_network_types: flat,vxlan
     bind:
       address: 172.16.10.101
diff --git a/tests/pillar/control_nodvr.sls b/tests/pillar/control_nodvr.sls
index 00a261c..9597eee 100644
--- a/tests/pillar/control_nodvr.sls
+++ b/tests/pillar/control_nodvr.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
       tenant_network_types: flat,vxlan
     bind:
       address: 172.16.10.101
diff --git a/tests/pillar/control_qos.sls b/tests/pillar/control_qos.sls
index d2fa118..9bed6b5 100644
--- a/tests/pillar/control_qos.sls
+++ b/tests/pillar/control_qos.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
       tenant_network_types: flat,vxlan
     bind:
       address: 172.16.10.101
diff --git a/tests/pillar/gateway_dvr.sls b/tests/pillar/gateway_dvr.sls
index 055997b..2c47529 100644
--- a/tests/pillar/gateway_dvr.sls
+++ b/tests/pillar/gateway_dvr.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: true
     enabled: true
     external_access: True
diff --git a/tests/pillar/gateway_legacy.sls b/tests/pillar/gateway_legacy.sls
index 75db492..d9b7ef8 100644
--- a/tests/pillar/gateway_legacy.sls
+++ b/tests/pillar/gateway_legacy.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     external_access: True
diff --git a/tests/pillar/gateway_legacy_fwaas_v1.sls b/tests/pillar/gateway_legacy_fwaas_v1.sls
index 2eacc5c..34e921c 100644
--- a/tests/pillar/gateway_legacy_fwaas_v1.sls
+++ b/tests/pillar/gateway_legacy_fwaas_v1.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     external_access: True
diff --git a/tests/pillar/gateway_qos.sls b/tests/pillar/gateway_qos.sls
index f5c3b0b..fea882e 100644
--- a/tests/pillar/gateway_qos.sls
+++ b/tests/pillar/gateway_qos.sls
@@ -5,8 +5,8 @@
       engine: ml2
       tenant_network_types: "flat,vxlan"
       mechanism:
-        - openvswitch
-        - l2population
+        ovs:
+          driver: openvswitch
     dvr: false
     enabled: true
     qos: true