[hopem,r=]

Fixes network-vlan-ranges parsing

Partially-Closes-Bug: 1451095
This commit is contained in:
Edward Hope-Morley 2015-05-13 12:20:38 +01:00
parent a29db44a40
commit 7213b596e5
3 changed files with 16 additions and 8 deletions

View File

@ -153,8 +153,10 @@ options:
type: string
default: "physnet1:1000:2000"
description: |
Space-delimited list of Neutron network-provider & vlan-id-ranges using
format "<provider>:<start>:<end> ...".
Space-delimited list of <physical_network>:<vlan_min>:<vlan_max> or
<physical_network> specifying physical_network names usable for VLAN
provider and tenant networks, as well as ranges of VLAN tags on each
available for allocation to tenant networks.
# Network configuration options
# by default all access is over 'private-address'
os-data-network:

View File

@ -256,11 +256,14 @@ def network_manager():
def parse_mappings(mappings):
parsed = {}
if mappings:
mappings = mappings.split(' ')
mappings = mappings.split()
for m in mappings:
p = m.partition(':')
if p[1] == ':':
parsed[p[0].strip()] = p[2].strip()
key = p[0].strip()
if p[1]:
parsed[key] = p[2].strip()
else:
parsed[key] = ''
return parsed
@ -283,13 +286,13 @@ def parse_data_port_mappings(mappings, default_bridge='br-data'):
Returns dict of the form {bridge:port}.
"""
_mappings = parse_mappings(mappings)
if not _mappings:
if not _mappings or _mappings.values() == ['']:
if not mappings:
return {}
# For backwards-compatibility we need to support port-only provided in
# config.
_mappings = {default_bridge: mappings.split(' ')[0]}
_mappings = {default_bridge: mappings.split()[0]}
bridges = _mappings.keys()
ports = _mappings.values()
@ -309,6 +312,8 @@ def parse_vlan_range_mappings(mappings):
Mappings must be a space-delimited list of provider:start:end mappings.
The start:end range is optional and may be omitted.
Returns dict of the form {provider: (start, end)}.
"""
_mappings = parse_mappings(mappings)

View File

@ -930,7 +930,8 @@ class TestQuantumAgentReallocation(CharmTestCase):
'process_name': 'neutron-nvsd-agent',
'executable_name': '/usr/local/bin/neutron-nvsd-agent',
'config_files': ['/etc/neutron/neutron.conf',
'/etc/neutron/plugins/oneconvergence/nvsdplugin.ini'],
'/etc/neutron/plugins/oneconvergence/'
'nvsdplugin.ini'],
'log_file': '/var/log/neutron/nvsd-agent.log',
}
neutron_plugin_openflow_context = {