let metaplugin work with plugin which has not l3 extension support
Fixes bug 1074183 Also Fixes bug 1074184 ( fix get_nework call with fields) Change-Id: I3bfdb22dd3be8a58cd884629dc5e3385730bb1bc
This commit is contained in:
parent
6b9784a606
commit
decb42d7d5
@ -153,7 +153,9 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
network[FLAVOR_NETWORK] = flavor
|
||||
|
||||
def _is_l3_plugin(self, plugin):
|
||||
return 'router' in plugin.supported_extension_aliases
|
||||
if hasattr(plugin, 'supported_extension_aliases'):
|
||||
return 'router' in plugin.supported_extension_aliases
|
||||
return False
|
||||
|
||||
def create_network(self, context, network):
|
||||
n = network['network']
|
||||
@ -204,7 +206,7 @@ class MetaPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
self._extend_network_dict_l3(context, net)
|
||||
if not fields or FLAVOR_NETWORK in fields:
|
||||
self._extend_network_dict(context, net)
|
||||
if fields and not id in fields:
|
||||
if fields and not 'id' in fields:
|
||||
del net['id']
|
||||
return net
|
||||
|
||||
|
@ -1666,6 +1666,17 @@ class TestNetworksV2(QuantumDbPluginV2TestCase):
|
||||
self.assertEquals(res['networks'][0]['name'],
|
||||
net2['network']['name'])
|
||||
|
||||
def test_list_networks_with_fields(self):
|
||||
with self.network(name='net1') as net1:
|
||||
req = self.new_list_request('networks',
|
||||
params='fields=name')
|
||||
res = self.deserialize('json', req.get_response(self.api))
|
||||
self.assertEquals(1, len(res['networks']))
|
||||
self.assertEquals(res['networks'][0]['name'],
|
||||
net1['network']['name'])
|
||||
self.assertEquals(None,
|
||||
res['networks'][0].get('id'))
|
||||
|
||||
def test_list_networks_with_parameters_invalid_values(self):
|
||||
with self.network(name='net1', admin_status_up=False) as net1:
|
||||
with self.network(name='net2') as net2:
|
||||
|
Loading…
Reference in New Issue
Block a user