Refactor mechanism driver metadata

Using a quite heavy nested dict structure for defining a list of
mechanism driver to load is an overkill. This change simplifies
the structure by turning it into a list.
The mechanism driver meta for gateway and compute nodes is now moved
to the system level (like it is already done for control nodes).
The l2population mechanism driver is still enabled by default,
however its enablement is no longer unconditional.

Change-Id: I4ae9c9c0562ef2271bf627d53d62aca60c101dab
diff --git a/README.rst b/README.rst
index 4a5787a..9fddb61 100644
--- a/README.rst
+++ b/README.rst
@@ -190,8 +190,8 @@
           tenant_network_types: "flat,vxlan"
           external_mtu: 9000
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Network Node
 
@@ -218,8 +218,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Compute Node
 
@@ -247,8 +247,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
         audit:
           enabled: false
 
@@ -299,8 +299,8 @@
           tenant_network_types= "flat,vxlan"
           external_mtu: 9000
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Network Node
 
@@ -328,8 +328,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Compute Node
 
@@ -353,8 +353,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Neutron VXLAN tenant networks with Network Nodes with DVR
 ---------------------------------------------------------
@@ -405,8 +405,8 @@
           tenant_network_types= "flat,vxlan"
           external_mtu: 9000
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Network Node
 
@@ -434,8 +434,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Compute Node
 
@@ -464,8 +464,8 @@
           engine: ml2
           tenant_network_types: "flat,vxlan"
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 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:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Compute node
 
@@ -587,8 +587,8 @@
           engine: ml2
           tenant_network_types: "flat,vlan" # Can be mixed flat,vlan,vxlan
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Advanced Neutron Features (DPDK, SR-IOV)
 
@@ -613,8 +613,8 @@
           engine: ml2
           ...
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Neutron OVS SR-IOV
 
@@ -627,10 +627,9 @@
           engine: ml2
           ...
           mechanism:
-            ovs:
-              driver: openvswitch
-            sriov:
-              driver: sriovnicswitch
+            - openvswitch
+            - sriovnicswitch
+            - l2population
 
     neutron:
       compute:
@@ -644,8 +643,8 @@
               devname: eth1
               physical_network: physnet3
           mechanism:
-            ovs:
-              driver: openvswitch
+            - openvswitch
+            - l2population
 
 Neutron with VLAN-aware-VMs
 
diff --git a/metadata/service/compute/single.yml b/metadata/service/compute/single.yml
index 377ff39..3334e5d 100644
--- a/metadata/service/compute/single.yml
+++ b/metadata/service/compute/single.yml
@@ -26,6 +26,3 @@
       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 1af2525..076a923 100644
--- a/metadata/service/gateway/single.yml
+++ b/metadata/service/gateway/single.yml
@@ -26,6 +26,3 @@
       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 9a8e79c..6b8ac92 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 ={%- for backend_name, mechanism in server.backend.get('mechanism', {}).iteritems() %}{{ mechanism.driver }},{%- endfor %}l2population
+mechanism_drivers = {{ ','.join(server.backend.get('mechanism', [])) }}
 
 # 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 9a8e79c..6b8ac92 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 ={%- for backend_name, mechanism in server.backend.get('mechanism', {}).iteritems() %}{{ mechanism.driver }},{%- endfor %}l2population
+mechanism_drivers = {{ ','.join(server.backend.get('mechanism', [])) }}
 
 # 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 5ecafe3..50fcd2c 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 ={%- for backend_name, mechanism in server.backend.get('mechanism', {}).iteritems() %}{{ mechanism.driver }},{%- endfor %}l2population
+mechanism_drivers = {{ ','.join(server.backend.get('mechanism', [])) }}
 
 # 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 c56fb81..2fb1462 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: false
     enabled: true
     external_access: false
diff --git a/tests/pillar/compute_dvr.sls b/tests/pillar/compute_dvr.sls
index 8d5f7d5..a6a512e 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     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 a4b86d2..f483775 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: true
     enabled: true
     external_access: true
diff --git a/tests/pillar/compute_legacy.sls b/tests/pillar/compute_legacy.sls
index 154af25..194e431 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: false
     enabled: true
     external_access: false
diff --git a/tests/pillar/compute_nonexternal_dvr.sls b/tests/pillar/compute_nonexternal_dvr.sls
index 8ce0da1..54ad7b3 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: true
     enabled: true
     external_access: false
diff --git a/tests/pillar/compute_qos.sls b/tests/pillar/compute_qos.sls
index 2122e00..b8a2699 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: false
     enabled: true
     qos: true
diff --git a/tests/pillar/compute_qos_sriov.sls b/tests/pillar/compute_qos_sriov.sls
index 7d4d4ab..5d5fb39 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: false
     enabled: true
     qos: true
diff --git a/tests/pillar/compute_sriov.sls b/tests/pillar/compute_sriov.sls
index f5a106f..1e85ccd 100644
--- a/tests/pillar/compute_sriov.sls
+++ b/tests/pillar/compute_sriov.sls
@@ -9,8 +9,8 @@
           devname: eth1
           physical_network: physnet3
       mechanism:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: false
     enabled: true
     external_access: false
diff --git a/tests/pillar/control_dvr.sls b/tests/pillar/control_dvr.sls
index 5031810..2156670 100644
--- a/tests/pillar/control_dvr.sls
+++ b/tests/pillar/control_dvr.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
       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 c39f05c..88f91ca 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
       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 65b0318..d96c3aa 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
       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 9597eee..00a261c 100644
--- a/tests/pillar/control_nodvr.sls
+++ b/tests/pillar/control_nodvr.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
       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 9bed6b5..d2fa118 100644
--- a/tests/pillar/control_qos.sls
+++ b/tests/pillar/control_qos.sls
@@ -4,8 +4,8 @@
       engine: ml2
       external_mtu: 1500
       mechanism:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
       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 2c47529..055997b 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: true
     enabled: true
     external_access: True
diff --git a/tests/pillar/gateway_legacy.sls b/tests/pillar/gateway_legacy.sls
index d9b7ef8..75db492 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     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 34e921c..2eacc5c 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: false
     enabled: true
     external_access: True
diff --git a/tests/pillar/gateway_qos.sls b/tests/pillar/gateway_qos.sls
index fea882e..f5c3b0b 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:
-        ovs:
-          driver: openvswitch
+        - openvswitch
+        - l2population
     dvr: false
     enabled: true
     qos: true