added vlan-ranges config

This commit is contained in:
Edward Hope-Morley 2015-03-16 18:43:06 +00:00
parent f4ead6d24b
commit 869669a926
3 changed files with 19 additions and 12 deletions

View File

@ -44,6 +44,11 @@ options:
description: |
Space-delimited list of ML2 data bridge mappings with format
<provider>:<bridge>.
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:

View File

@ -39,21 +39,18 @@ def _neutron_api_settings():
for rid in relation_ids('neutron-plugin-api'):
for unit in related_units(rid):
rdata = relation_get(rid=rid, unit=unit)
if 'l2-population' not in rdata:
continue
neutron_settings = {
'l2_population': bool_from_string(rdata['l2-population']),
'overlay_network_type': rdata['overlay-network-type'],
'neutron_security_groups': bool_from_string(
rdata['neutron-security-groups']
),
}
if 'l2-population' in rdata:
neutron_settings.update({
'l2_population': bool_from_string(rdata['l2-population']),
'overlay_network_type': rdata['overlay-network-type'],
'neutron_security_groups':
bool_from_string(rdata['neutron-security-groups'])
})
net_dev_mtu = rdata.get('network-device-mtu')
if net_dev_mtu:
neutron_settings['network_device_mtu'] = net_dev_mtu
return neutron_settings
return neutron_settings
@ -157,6 +154,7 @@ class OVSPluginContext(context.NeutronContext):
class PhyNICMTUContext(DataPortContext):
"""Context used to apply settings to neutron data-port devices"""
def __call__(self):
ctxt = {}

View File

@ -121,7 +121,9 @@ class OVSPluginContextTest(CharmTestCase):
'neutron_url': 'https://127.0.0.13:9696',
'l2_population': True,
'overlay_network_type': 'gre',
'bridge_mappings': 'physnet1:br-data'
'network_providers': 'physnet1',
'bridge_mappings': 'physnet1:br-data',
'vlan_ranges': 'physnet1:1000:2000',
}
self.assertEquals(expect, napi_ctxt())
self.service_start.assertCalled()
@ -179,7 +181,9 @@ class OVSPluginContextTest(CharmTestCase):
'neutron_url': 'https://127.0.0.13:9696',
'l2_population': True,
'overlay_network_type': 'gre',
'bridge_mappings': 'physnet1:br-data'
'network_providers': 'physnet1',
'bridge_mappings': 'physnet1:br-data',
'vlan_ranges': 'physnet1:1000:2000',
}
self.assertEquals(expect, napi_ctxt())
self.service_start.assertCalled()