fixed neutronng state for mitaka
Change-Id: Ide47eb5e89757752a87b2e74ded5767ab39a9eb0
diff --git a/_states/neutronng.py b/_states/neutronng.py
index df0736d..9d4deaa 100644
--- a/_states/neutronng.py
+++ b/_states/neutronng.py
@@ -86,8 +86,11 @@
tenant_id = None
LOG.debug('Cannot get the tenant id. User {0} is not an admin.'.format(
connection_args['connection_user']))
- existing_network = _neutron_module_call(
- 'list_networks', name=name, **connection_args)
+ existing_networks = _neutron_module_call(
+ 'list_networks', **connection_args)
+ for network in existing_networks:
+ if network.get(name) == name:
+ existing_network = network
network_arguments = _get_non_null_args(
name=name,
provider_network_type=provider_network_type,
@@ -101,8 +104,11 @@
if not existing_network:
network_arguments.update(connection_args)
_neutron_module_call('create_network', **network_arguments)
- existing_network = _neutron_module_call(
- 'list_networks', name=name, **connection_args)
+ existing_networks = _neutron_module_call(
+ 'list_networks', **connection_args)
+ for network in existing_networks:
+ if network.get(name) == name:
+ existing_network = network
if existing_network:
return _created(name, 'network', existing_network[name])
return _update_failed(name, 'network')