[hopem,r=]

Allow flat network providers to be configured seperately to vlan
providers.

Closes-Bug: 1444470
This commit is contained in:
Edward Hope-Morley 2015-04-15 15:08:36 +01:00
parent 8c6974fe23
commit 43794ee5a7
3 changed files with 15 additions and 12 deletions

View File

@ -44,11 +44,17 @@ options:
description: |
Space-delimited list of ML2 data bridge mappings with format
<provider>:<bridge>.
flat-network-providers:
type: string
default:
description: |
Space-delimited list of Neutron flat network providers.
vlan-ranges:
type: string
default: "physnet1:1000:2000"
description: |
Space-delimited list of network provider vlan id ranges.
Space-delimited list of Neutron network-provider & vlan-id-ranges using
the following format (<provider>:<start>:<end>).
# Network configuration options
# by default all access is over 'private-address'
os-data-network:

View File

@ -15,9 +15,6 @@ from charmhelpers.contrib.openstack.context import (
OSContextGenerator,
NeutronAPIContext,
)
from charmhelpers.contrib.openstack.neutron import (
parse_vlan_range_mappings,
)
class OVSPluginContext(context.NeutronContext):
@ -73,11 +70,12 @@ class OVSPluginContext(context.NeutronContext):
if mappings:
ovs_ctxt['bridge_mappings'] = ','.join(mappings.split())
flat_providers = config('flat-network-providers')
if flat_providers:
ovs_ctxt['network_providers'] = ','.join(flat_providers.split())
vlan_ranges = config('vlan-ranges')
vlan_range_mappings = parse_vlan_range_mappings(vlan_ranges)
if vlan_ranges:
providers = vlan_range_mappings.keys()
ovs_ctxt['network_providers'] = ','.join(sorted(providers))
ovs_ctxt['vlan_ranges'] = ','.join(vlan_ranges.split())
return ovs_ctxt

View File

@ -92,7 +92,8 @@ class OVSPluginContextTest(CharmTestCase):
'use-syslog': True,
'verbose': True,
'debug': True,
'bridge-mappings': "physnet1:br-data physnet2:br-data"}
'bridge-mappings': "physnet1:br-data physnet2:br-data",
'flat-network-providers': 'physnet3 physnet4'}
def mock_config(key=None):
if key:
@ -100,8 +101,7 @@ class OVSPluginContextTest(CharmTestCase):
return config
self.maxDiff = None
self.config.side_effect = mock_config
self.config.side_effect = mock_config
_npa.side_effect = mock_npa
_unit_get.return_value = '127.0.0.13'
_unit_priv_ip.return_value = '127.0.0.14'
@ -134,7 +134,7 @@ class OVSPluginContextTest(CharmTestCase):
'neutron_url': 'https://127.0.0.13:9696',
'l2_population': True,
'overlay_network_type': 'gre',
'network_providers': 'physnet1,physnet2',
'network_providers': 'physnet3,physnet4',
'bridge_mappings': 'physnet1:br-data,physnet2:br-data',
'vlan_ranges': 'physnet1:1000:1500,physnet2:2000:2500',
}
@ -199,7 +199,6 @@ class OVSPluginContextTest(CharmTestCase):
'neutron_url': 'https://127.0.0.13:9696',
'l2_population': True,
'overlay_network_type': 'gre',
'network_providers': 'physnet1',
'bridge_mappings': 'physnet1:br-data',
'vlan_ranges': 'physnet1:1000:2000',
}