Merge "Allow configuring Neutron LBaaSv2 with Octavia"
diff --git a/README.rst b/README.rst
index 370240e..9adbc21 100644
--- a/README.rst
+++ b/README.rst
@@ -8,7 +8,7 @@
 
 Starting in the Folsom release, Neutron is a core and supported part of the
 OpenStack platform (for Essex, we were an "incubated" project, which means use
-is suggested only for those who really know what they're doing with Neutron). 
+is suggested only for those who really know what they're doing with Neutron).
 
 Sample Pillars
 ==============
@@ -130,11 +130,11 @@
 
 This use case describes a model utilising VxLAN overlay with DVR. The DVR
 routers will only be utilized for traffic that is router within the cloud
-infrastructure and that remains encapsulated. External traffic will be 
-routed to via the network nodes. 
+infrastructure and that remains encapsulated. External traffic will be
+routed to via the network nodes.
 
-The intention is that each tenant will require at least two (2) vrouters 
-one to be utilised 
+The intention is that each tenant will require at least two (2) vrouters
+one to be utilised
 
 Neutron Server
 
@@ -206,7 +206,7 @@
           tenant_network_types: "flat,vxlan"
           mechanism:
             ovs:
-              driver: openvswitch  
+              driver: openvswitch
 
 Compute Node
 
@@ -229,7 +229,7 @@
         external_access: false # Compute node with DVR for east-west only, Network Node has True as default
         metadata:
           host: 127.0.0.1
-          password: pass       
+          password: pass
         backend:
           engine: ml2
           tenant_network_types: "flat,vxlan"
@@ -317,7 +317,7 @@
           tenant_network_types: "flat,vxlan"
           mechanism:
             ovs:
-              driver: openvswitch  
+              driver: openvswitch
 
 Compute Node
 
@@ -336,7 +336,7 @@
           virtual_host: '/openstack'
         local_ip: 192.168.20.20 # br-mesh ip address
         external_access: False
-        dvr: False      
+        dvr: False
         backend:
           engine: ml2
           tenant_network_types: "flat,vxlan"
@@ -349,8 +349,8 @@
 
 With DVR for East-West and North-South, DVR everywhere, Network node for SNAT.
 
-This section describes a network solution that utilises VxLAN 
-overlay networks with DVR with North-South and East-West. Network 
+This section describes a network solution that utilises VxLAN
+overlay networks with DVR with North-South and East-West. Network
 Node is used only for SNAT.
 
 Neutron Server
@@ -424,7 +424,7 @@
           tenant_network_types: "flat,vxlan"
           mechanism:
             ovs:
-              driver: openvswitch  
+              driver: openvswitch
 
 Compute Node
 
@@ -443,7 +443,7 @@
           virtual_host: '/openstack'
         local_ip: 192.168.20.20 # br-mesh ip address
         dvr: True
-        external_access: True     
+        external_access: True
         agent_mode: dvr
         availability_zone: az1
         metadata:
diff --git a/neutron/files/mitaka/openvswitch_agent.ini b/neutron/files/mitaka/openvswitch_agent.ini
index b93aaeb..ed5231b 100644
--- a/neutron/files/mitaka/openvswitch_agent.ini
+++ b/neutron/files/mitaka/openvswitch_agent.ini
@@ -189,12 +189,16 @@
 # a physical network interface configured as a port. All physical networks configured on the server should have mappings to appropriate
 # bridges on each agent. Note: If you remove a bridge from this mapping, make sure to disconnect it from the integration bridge as it won't
 # be managed by the agent anymore. Deprecated for ofagent. (list value)
+{% set bridge_mappings=[] %}
+{%- if neutron.get('external_access', True) %}{% do bridge_mappings.append('physnet1:br-floating') %}{%- endif %}
+{%- if "vlan" in neutron.backend.tenant_network_types %}{% do bridge_mappings.append('physnet2:br-prv') %}{%- endif %}
+{%- if neutron.get('ironic_enabled', False) %}{% do bridge_mappings.append('physnet3:br-baremetal') %}{%- endif %}
+{%- if bridge_mappings %}
+bridge_mappings = {{ ','.join(bridge_mappings) }}
+{%- else %}
 #bridge_mappings =
-{%- if "vlan" in neutron.backend.tenant_network_types %}
-bridge_mappings ={%- if neutron.get('external_access', True) %}physnet1:br-floating,{%- endif %}physnet2:br-prv
-{%- elif neutron.get('external_access', True) %}
-bridge_mappings =physnet1:br-floating
 {%- endif %}
+
 # Use veths instead of patch ports to interconnect the integration bridge to physical networks. Support kernel without Open vSwitch patch
 # port support so long as it is set to True. (boolean value)
 #use_veth_interconnection = false
diff --git a/neutron/files/newton/openvswitch_agent.ini b/neutron/files/newton/openvswitch_agent.ini
index b93aaeb..ed5231b 100644
--- a/neutron/files/newton/openvswitch_agent.ini
+++ b/neutron/files/newton/openvswitch_agent.ini
@@ -189,12 +189,16 @@
 # a physical network interface configured as a port. All physical networks configured on the server should have mappings to appropriate
 # bridges on each agent. Note: If you remove a bridge from this mapping, make sure to disconnect it from the integration bridge as it won't
 # be managed by the agent anymore. Deprecated for ofagent. (list value)
+{% set bridge_mappings=[] %}
+{%- if neutron.get('external_access', True) %}{% do bridge_mappings.append('physnet1:br-floating') %}{%- endif %}
+{%- if "vlan" in neutron.backend.tenant_network_types %}{% do bridge_mappings.append('physnet2:br-prv') %}{%- endif %}
+{%- if neutron.get('ironic_enabled', False) %}{% do bridge_mappings.append('physnet3:br-baremetal') %}{%- endif %}
+{%- if bridge_mappings %}
+bridge_mappings = {{ ','.join(bridge_mappings) }}
+{%- else %}
 #bridge_mappings =
-{%- if "vlan" in neutron.backend.tenant_network_types %}
-bridge_mappings ={%- if neutron.get('external_access', True) %}physnet1:br-floating,{%- endif %}physnet2:br-prv
-{%- elif neutron.get('external_access', True) %}
-bridge_mappings =physnet1:br-floating
 {%- endif %}
+
 # Use veths instead of patch ports to interconnect the integration bridge to physical networks. Support kernel without Open vSwitch patch
 # port support so long as it is set to True. (boolean value)
 #use_veth_interconnection = false
diff --git a/neutron/files/ocata/openvswitch_agent.ini b/neutron/files/ocata/openvswitch_agent.ini
index ef9d767..2de0352 100644
--- a/neutron/files/ocata/openvswitch_agent.ini
+++ b/neutron/files/ocata/openvswitch_agent.ini
@@ -240,11 +240,14 @@
 # have mappings to appropriate bridges on each agent. Note: If you remove a
 # bridge from this mapping, make sure to disconnect it from the integration
 # bridge as it won't be managed by the agent anymore. (list value)
+{% set bridge_mappings=[] %}
+{%- if neutron.get('external_access', True) %}{% do bridge_mappings.append('physnet1:br-floating') %}{%- endif %}
+{%- if "vlan" in neutron.backend.tenant_network_types %}{% do bridge_mappings.append('physnet2:br-prv') %}{%- endif %}
+{%- if neutron.get('ironic_enabled', False) %}{% do bridge_mappings.append('physnet3:br-baremetal') %}{%- endif %}
+{%- if bridge_mappings %}
+bridge_mappings = {{ ','.join(bridge_mappings) }}
+{%- else %}
 #bridge_mappings =
-{%- if "vlan" in neutron.backend.tenant_network_types %}
-bridge_mappings ={%- if neutron.get('external_access', True) %}physnet1:br-floating,{%- endif %}physnet2:br-prv
-{%- elif neutron.get('external_access', True) %}
-bridge_mappings =physnet1:br-floating
 {%- endif %}
 
 # Use veths instead of patch ports to interconnect the integration bridge to