diff --git a/config.yaml b/config.yaml index e964222f..930c2e78 100644 --- a/config.yaml +++ b/config.yaml @@ -120,6 +120,11 @@ options: description: | Space-separated list of ML2 data bridge mappings with format :. + vlan-ranges: + type: string + default: "physnet1:1000:2000" + description: | + Space-delimited list of network provider vlan id ranges. # Network configuration options # by default all access is over 'private-address' os-data-network: diff --git a/hooks/quantum_contexts.py b/hooks/quantum_contexts.py index 9a14da63..be6e7fee 100644 --- a/hooks/quantum_contexts.py +++ b/hooks/quantum_contexts.py @@ -29,6 +29,7 @@ from charmhelpers.contrib.network.ip import ( ) from charmhelpers.contrib.openstack.neutron import ( parse_data_port_mappings, + parse_vlan_range_mappings, ) from charmhelpers.core.host import ( get_nic_hwaddr, @@ -253,6 +254,12 @@ class QuantumGatewayContext(OSContextGenerator): if mappings: ctxt['bridge_mappings'] = mappings + vlan_ranges = config('vlan-ranges') + vlan_range_mappings = parse_vlan_range_mappings(config('vlan-ranges')) + if vlan_ranges: + ctxt['network_providers'] = ' '.join(vlan_range_mappings.keys()) + ctxt['vlan_ranges'] = vlan_ranges + net_dev_mtu = neutron_api_settings.get('network_device_mtu') if net_dev_mtu: ctxt['network_device_mtu'] = net_dev_mtu diff --git a/templates/icehouse/ml2_conf.ini b/templates/icehouse/ml2_conf.ini index 4275b303..c9c04982 100644 --- a/templates/icehouse/ml2_conf.ini +++ b/templates/icehouse/ml2_conf.ini @@ -14,10 +14,10 @@ tunnel_id_ranges = 1:1000 vni_ranges = 1001:2000 [ml2_type_vlan] -network_vlan_ranges = physnet1:1000:2000 +network_vlan_ranges = {{ vlan_ranges }} [ml2_type_flat] -flat_networks = physnet1 +flat_networks = {{ network_providers }} [ovs] enable_tunneling = True diff --git a/unit_tests/test_quantum_contexts.py b/unit_tests/test_quantum_contexts.py index d572507d..03ef3247 100644 --- a/unit_tests/test_quantum_contexts.py +++ b/unit_tests/test_quantum_contexts.py @@ -279,6 +279,8 @@ class TestQuantumGatewayContext(CharmTestCase): 'l2_population': False, 'overlay_network_type': 'gre', 'bridge_mappings': 'physnet1:br-data', + 'network_providers': 'physnet1', + 'vlan_ranges': 'physnet1:1000:2000' })