Merge "Search for both name and tag if tag is given."
This commit is contained in:
commit
0fef11cd5e
@ -563,10 +563,10 @@ def _create_kuryr_subnet(pool_cidr, subnet_cidr, pool_id, network_id, gateway):
|
||||
|
||||
def _create_kuryr_subnetpool(pool_cidr, pool_tag):
|
||||
pool_name = lib_utils.get_neutron_subnetpool_name(pool_cidr)
|
||||
|
||||
kwargs = {'name': pool_name}
|
||||
if pool_tag:
|
||||
kwargs = {'tags': [pool_tag]}
|
||||
else:
|
||||
kwargs = {'name': pool_name}
|
||||
kwargs['tags'] = [pool_tag]
|
||||
pools = _get_subnetpools_by_attrs(**kwargs)
|
||||
if len(pools):
|
||||
raise exceptions.KuryrException(
|
||||
|
@ -109,7 +109,7 @@ class TestKuryrIpam(base.TestKuryrBase):
|
||||
|
||||
self.assertEqual(200, response.status_code)
|
||||
mock_list_subnetpools.assert_called_with(
|
||||
tags=[str(neutron_subnet_v4_id)])
|
||||
name=pool_name, tags=[str(neutron_subnet_v4_id)])
|
||||
mock_create_subnetpool.assert_called_with(
|
||||
{'subnetpool': new_subnetpool})
|
||||
mock_add_tag.assert_called_once_with(
|
||||
@ -184,7 +184,7 @@ class TestKuryrIpam(base.TestKuryrBase):
|
||||
self.assertEqual(200, response.status_code)
|
||||
mock_list_subnets.assert_called_with(name=neutron_subnet_v4_name)
|
||||
mock_list_subnetpools.assert_called_with(
|
||||
tags=[str(neutron_subnet_v4_id)])
|
||||
name=pool_name, tags=[str(neutron_subnet_v4_id)])
|
||||
mock_create_subnetpool.assert_called_with(
|
||||
{'subnetpool': new_subnetpool})
|
||||
mock_add_tag.assert_called_once_with(
|
||||
|
Loading…
Reference in New Issue
Block a user