Replace deprecated tenant_id property
The tenant_id property of RestClient in tempest was deprecated in 25.0.0. This replaces the deprecated property by the new project_id property to avoid the following warning. WARNING tempest.lib.common.rest_client [-] Deprecated: "tenant_id" property is deprecated for removal, use "project_id" instead Depends-on: https://review.opendev.org/c/openstack/tempest/+/707938 Change-Id: Ie3c32f9f2278b78603a4214c5717df8691ba490a
This commit is contained in:
parent
6e4d04071b
commit
da45177a2f
@ -53,7 +53,7 @@ class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_external',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
body = self.client2.list_networks()
|
||||
networks_list = [n['id'] for n in body['networks']]
|
||||
self.assertIn(net['id'], networks_list)
|
||||
@ -107,7 +107,7 @@ class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
|
||||
# changing wildcard to specific tenant should be okay since its the
|
||||
# only one using the network
|
||||
self.admin_client.update_rbac_policy(
|
||||
rbac_pol['id'], target_tenant=self.client2.tenant_id)
|
||||
rbac_pol['id'], target_tenant=self.client2.project_id)
|
||||
|
||||
@decorators.idempotent_id('a5539002-5bdb-48b5-b124-e9eedd5975e6')
|
||||
def test_external_conversion_on_policy_create(self):
|
||||
@ -115,7 +115,7 @@ class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net_id,
|
||||
action='access_as_external',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
body = self.admin_client.show_network(net_id)['network']
|
||||
self.assertTrue(body['router:external'])
|
||||
|
||||
@ -138,13 +138,13 @@ class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net_id,
|
||||
action='access_as_external',
|
||||
target_tenant=self.admin_client.tenant_id)
|
||||
target_tenant=self.admin_client.project_id)
|
||||
body = self.admin_client.show_network(net_id)['network']
|
||||
self.assertTrue(body['router:external'])
|
||||
policy2 = self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net_id,
|
||||
action='access_as_external',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
self.admin_client.delete_rbac_policy(policy2['rbac_policy']['id'])
|
||||
body = self.admin_client.show_network(net_id)['network']
|
||||
self.assertTrue(body['router:external'])
|
||||
@ -168,14 +168,14 @@ class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_external',
|
||||
target_tenant=self.admin_client.tenant_id)
|
||||
target_tenant=self.admin_client.project_id)
|
||||
self.create_subnet(net, client=self.admin_client, enable_dhcp=False)
|
||||
with testtools.ExpectedException(lib_exc.NotFound):
|
||||
self.create_floatingip(net['id'], client=self.client2)
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_external',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
self.create_floatingip(net['id'], client=self.client2)
|
||||
|
||||
@decorators.idempotent_id('476be1e0-f72e-47dc-9a14-4435926bbe82')
|
||||
@ -185,7 +185,7 @@ class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_external',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
r = self.client2.create_router(
|
||||
data_utils.rand_name('router'),
|
||||
external_gateway_info={'network_id': net['id']})['router']
|
||||
@ -209,7 +209,7 @@ class ExternalNetworksRBACTestJSON(base.BaseAdminNetworkTest):
|
||||
tenant = self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_external',
|
||||
target_tenant=self.client2.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client2.project_id)['rbac_policy']
|
||||
# now we can delete the policy because the tenant has its own policy
|
||||
# to allow it access
|
||||
self.admin_client.delete_rbac_policy(wildcard['id'])
|
||||
|
@ -25,7 +25,7 @@ class NetworksTestAdmin(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('d3c76044-d067-4cb0-ae47-8cdd875c7f67')
|
||||
@utils.requires_ext(extension="project-id", service="network")
|
||||
def test_create_network_with_project(self):
|
||||
project_id = self.client.tenant_id # non-admin
|
||||
project_id = self.client.project_id # non-admin
|
||||
|
||||
name = 'admin-created-with-project_id'
|
||||
network = self.create_network(name, project_id=project_id,
|
||||
@ -43,7 +43,7 @@ class NetworksTestAdmin(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('8d21aaca-4364-4eb9-8b79-44b4fff6373b')
|
||||
@utils.requires_ext(extension="project-id", service="network")
|
||||
def test_create_network_with_project_and_tenant(self):
|
||||
project_id = self.client.tenant_id # non-admin
|
||||
project_id = self.client.project_id # non-admin
|
||||
|
||||
name = 'created-with-project-and-tenant'
|
||||
network = self.create_network(name, project_id=project_id,
|
||||
@ -62,7 +62,7 @@ class NetworksTestAdmin(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('08b92179-669d-45ee-8233-ef6611190809')
|
||||
@utils.requires_ext(extension="project-id", service="network")
|
||||
def test_create_network_with_project_and_other_tenant(self):
|
||||
project_id = self.client.tenant_id # non-admin
|
||||
project_id = self.client.project_id # non-admin
|
||||
other_tenant = uuidutils.generate_uuid()
|
||||
|
||||
name = 'created-with-project-and-other-tenant'
|
||||
|
@ -214,7 +214,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-afffffff1fff')
|
||||
def test_network_only_visible_to_policy_target(self):
|
||||
net = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)['network']
|
||||
self.client.project_id)['network']
|
||||
self.client.show_network(net['id'])
|
||||
with testtools.ExpectedException(lib_exc.NotFound):
|
||||
# client2 has not been granted access
|
||||
@ -223,7 +223,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-afffffff2fff')
|
||||
def test_subnet_on_network_only_visible_to_policy_target(self):
|
||||
sub = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)['subnet']
|
||||
self.client.project_id)['subnet']
|
||||
self.client.show_subnet(sub['id'])
|
||||
with testtools.ExpectedException(lib_exc.NotFound):
|
||||
# client2 has not been granted access
|
||||
@ -232,11 +232,11 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-afffffff2eee')
|
||||
def test_policy_target_update(self):
|
||||
res = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
# change to client2
|
||||
update_res = self.admin_client.update_rbac_policy(
|
||||
res['policy']['id'], target_tenant=self.client2.tenant_id)
|
||||
self.assertEqual(self.client2.tenant_id,
|
||||
res['policy']['id'], target_tenant=self.client2.project_id)
|
||||
self.assertEqual(self.client2.project_id,
|
||||
update_res['rbac_policy']['target_tenant'])
|
||||
# make sure everything else stayed the same
|
||||
res['policy'].pop('target_tenant')
|
||||
@ -246,16 +246,17 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-affefefef321')
|
||||
def test_duplicate_policy_error(self):
|
||||
res = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
with testtools.ExpectedException(lib_exc.Conflict):
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=res['network']['id'],
|
||||
action='access_as_shared', target_tenant=self.client.tenant_id)
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.project_id)
|
||||
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-afffffff3fff')
|
||||
def test_port_presence_prevents_network_rbac_policy_deletion(self):
|
||||
res = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
port = self.create_port(res['network'])
|
||||
# a port on the network should prevent the deletion of a policy
|
||||
# required for it to exist
|
||||
@ -282,7 +283,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
net = self.create_network() # owned by self.client
|
||||
self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
port = self.client2.create_port(network_id=net['id'])['port']
|
||||
self.client.delete_port(port['id'])
|
||||
|
||||
@ -300,7 +301,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
self.client2.show_network(net['id'])
|
||||
pol = self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
self.client2.show_network(net['id'])
|
||||
|
||||
self.assertIn(pol['rbac_policy'],
|
||||
@ -316,7 +317,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
net = self.create_network()
|
||||
self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
|
||||
('project_id', 'target_tenant'))
|
||||
for fields in field_args:
|
||||
@ -326,7 +327,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-afffffff5fff')
|
||||
def test_policy_show(self):
|
||||
res = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
p1 = res['policy']
|
||||
p2 = self.admin_client.create_rbac_policy(
|
||||
object_type='network', object_id=res['network']['id'],
|
||||
@ -344,11 +345,11 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
pol1 = self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client2.project_id)['rbac_policy']
|
||||
pol2 = self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
res1 = self.client.list_rbac_policies(id=pol1['id'])['rbac_policies']
|
||||
res2 = self.client.list_rbac_policies(id=pol2['id'])['rbac_policies']
|
||||
self.assertEqual(1, len(res1))
|
||||
@ -359,16 +360,17 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-afffffff6fff')
|
||||
def test_regular_client_blocked_from_sharing_anothers_network(self):
|
||||
net = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)['network']
|
||||
self.client.project_id)['network']
|
||||
with testtools.ExpectedException(lib_exc.BadRequest):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_shared', target_tenant=self.client.tenant_id)
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.project_id)
|
||||
|
||||
@decorators.idempotent_id('c5f8f785-ce8d-4430-af7e-a236205862fb')
|
||||
@utils.requires_ext(extension="quotas", service="network")
|
||||
def test_rbac_policy_quota(self):
|
||||
quota = self.client.show_quotas(self.client.tenant_id)['quota']
|
||||
quota = self.client.show_quotas(self.client.project_id)['quota']
|
||||
max_policies = quota['rbac_policy']
|
||||
self.assertGreater(max_policies, 0)
|
||||
net = self.client.create_network(
|
||||
@ -391,7 +393,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
# ensure it works on update as well
|
||||
pol = self.client.create_rbac_policy(
|
||||
object_type='network', object_id=net['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
with testtools.ExpectedException(lib_exc.Forbidden):
|
||||
self.client.update_rbac_policy(pol['rbac_policy']['id'],
|
||||
target_tenant='*')
|
||||
@ -405,14 +407,14 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
target_tenant=net['project_id'])['rbac_policy']
|
||||
port = self.create_port(net)
|
||||
self.client.update_rbac_policy(self_share['id'],
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
self.client.delete_port(port['id'])
|
||||
|
||||
@utils.requires_ext(extension="standard-attr-revisions", service="network")
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-1234-89664291a4cb')
|
||||
def test_rbac_bumps_network_revision(self):
|
||||
resp = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
net_id = resp['network']['id']
|
||||
rev = self.client.show_network(net_id)['network']['revision_number']
|
||||
self.admin_client.create_rbac_policy(
|
||||
@ -426,7 +428,7 @@ class RBACSharedNetworksTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('86c3529b-1231-40de-803c-aeeeeeee7fff')
|
||||
def test_filtering_works_with_rbac_records_present(self):
|
||||
resp = self._make_admin_net_and_subnet_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
net = resp['network']['id']
|
||||
sub = resp['subnet']['id']
|
||||
self.admin_client.create_rbac_policy(
|
||||
|
@ -386,7 +386,7 @@ class BaseNetworkTest(test.BaseTestCase):
|
||||
# Keep this network visible from current project
|
||||
project_id = (kwargs.get('project_id') or
|
||||
kwargs.get('tenant_id') or
|
||||
cls.client.tenant_id)
|
||||
cls.client.project_id)
|
||||
kwargs.update(project_id=project_id, tenant_id=project_id)
|
||||
else:
|
||||
# Use default client
|
||||
|
@ -171,11 +171,11 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('95f59a88-c47e-4dd9-a231-85f1782753a7')
|
||||
def test_policy_target_update(self):
|
||||
res = self._make_admin_ag_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
# change to client2
|
||||
update_res = self.admin_client.update_rbac_policy(
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
|
||||
self.assertEqual(self.client2.tenant_id,
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.project_id)
|
||||
self.assertEqual(self.client2.project_id,
|
||||
update_res['rbac_policy']['target_tenant'])
|
||||
# make sure everything else stayed the same
|
||||
res['rbac_policy'].pop('target_tenant')
|
||||
@ -185,7 +185,7 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('35a214c9-5c99-468f-9242-34d0529cabfa')
|
||||
def test_secgrprule_presence_prevents_policy_rbac_policy_deletion(self):
|
||||
res = self._make_admin_ag_shared_to_project_id(
|
||||
self.client2.tenant_id)
|
||||
self.client2.project_id)
|
||||
ag_id = res['address_group']['id']
|
||||
security_group = self.create_security_group(client=self.client2)
|
||||
protocol = random.choice(list(base_security_groups.V4_PROTOCOL_NAMES))
|
||||
@ -213,7 +213,7 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
rbac_policy = self.admin_client.create_rbac_policy(
|
||||
object_type='address_group', object_id=ag['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
self.client.show_address_group(ag['id'])
|
||||
|
||||
self.assertIn(rbac_policy,
|
||||
@ -228,7 +228,7 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
ag = self._create_address_group()
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='address_group', object_id=ag['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
|
||||
('project_id', 'target_tenant'))
|
||||
for fields in field_args:
|
||||
@ -238,7 +238,7 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('20b2706b-1cea-4724-ab72-d7452ecb1fc4')
|
||||
def test_rbac_policy_show(self):
|
||||
res = self._make_admin_ag_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
p1 = res['rbac_policy']
|
||||
p2 = self.admin_client.create_rbac_policy(
|
||||
object_type='address_group',
|
||||
@ -257,11 +257,11 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
rbac_pol1 = self.admin_client.create_rbac_policy(
|
||||
object_type='address_group', object_id=ag['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client2.project_id)['rbac_policy']
|
||||
rbac_pol2 = self.admin_client.create_rbac_policy(
|
||||
object_type='address_group', object_id=ag['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.admin_client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.admin_client.project_id)['rbac_policy']
|
||||
res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
|
||||
'rbac_policies']
|
||||
res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
|
||||
@ -274,12 +274,12 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('a0f3a01a-e2c7-47d6-9385-0cd7a7f0c996')
|
||||
def test_regular_client_blocked_from_sharing_anothers_policy(self):
|
||||
ag = self._make_admin_ag_shared_to_project_id(
|
||||
self.client.tenant_id)['address_group']
|
||||
self.client.project_id)['address_group']
|
||||
with testtools.ExpectedException(exceptions.BadRequest):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='address_group', object_id=ag['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
|
||||
# make sure the rbac-policy is invisible to the tenant for which it's
|
||||
# being shared
|
||||
@ -292,7 +292,7 @@ class RbacSharedAddressGroupTest(base.BaseAdminNetworkTest):
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='address_group', object_id=ag['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
self.client.show_address_group(ag['id'])
|
||||
with testtools.ExpectedException(exceptions.NotFound):
|
||||
self.client.update_address_group(ag['id'], name='new_name')
|
||||
|
@ -86,8 +86,8 @@ class AddressScopeTest(AddressScopeTestBase):
|
||||
show_addr_scope = body['address_scope']
|
||||
self.assertIn('project_id', show_addr_scope)
|
||||
self.assertIn('tenant_id', show_addr_scope)
|
||||
self.assertEqual(self.client.tenant_id, show_addr_scope['project_id'])
|
||||
self.assertEqual(self.client.tenant_id, show_addr_scope['tenant_id'])
|
||||
self.assertEqual(self.client.project_id, show_addr_scope['project_id'])
|
||||
self.assertEqual(self.client.project_id, show_addr_scope['tenant_id'])
|
||||
|
||||
@decorators.idempotent_id('85a259b2-ace6-4e32-9657-a9a392b452aa')
|
||||
def test_tenant_update_address_scope(self):
|
||||
@ -142,11 +142,11 @@ class RbacAddressScopeTest(AddressScopeTestBase):
|
||||
@decorators.idempotent_id('038e999b-cd4b-4021-a9ff-ebb734f6e056')
|
||||
def test_policy_target_update(self):
|
||||
res = self._make_admin_as_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
# change to client2
|
||||
update_res = self.admin_client.update_rbac_policy(
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
|
||||
self.assertEqual(self.client2.tenant_id,
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.project_id)
|
||||
self.assertEqual(self.client2.project_id,
|
||||
update_res['rbac_policy']['target_tenant'])
|
||||
# make sure everything else stayed the same
|
||||
res['rbac_policy'].pop('target_tenant')
|
||||
@ -156,7 +156,7 @@ class RbacAddressScopeTest(AddressScopeTestBase):
|
||||
@decorators.idempotent_id('798ac6c6-96cc-49ce-ba5c-c6eced7a09d3')
|
||||
def test_subnet_pool_presence_prevents_rbac_policy_deletion(self):
|
||||
res = self._make_admin_as_shared_to_project_id(
|
||||
self.client2.tenant_id)
|
||||
self.client2.project_id)
|
||||
snp = self.create_subnetpool(
|
||||
data_utils.rand_name("rbac-address-scope"),
|
||||
default_prefixlen=24, prefixes=['10.0.0.0/8'],
|
||||
@ -183,7 +183,7 @@ class RbacAddressScopeTest(AddressScopeTestBase):
|
||||
rbac_policy = self.admin_client.create_rbac_policy(
|
||||
object_type='address_scope', object_id=a_s['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
self.client.show_address_scope(a_s['id'])
|
||||
|
||||
self.assertIn(rbac_policy,
|
||||
@ -198,7 +198,7 @@ class RbacAddressScopeTest(AddressScopeTestBase):
|
||||
a_s = self._create_address_scope(ip_version=4)
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='address_scope', object_id=a_s['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
|
||||
('project_id', 'target_tenant'))
|
||||
for fields in field_args:
|
||||
@ -208,7 +208,7 @@ class RbacAddressScopeTest(AddressScopeTestBase):
|
||||
@decorators.idempotent_id('19cbd62e-c6c3-4495-98b9-b9c6c6c9c127')
|
||||
def test_rbac_policy_show(self):
|
||||
res = self._make_admin_as_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
p1 = res['rbac_policy']
|
||||
p2 = self.admin_client.create_rbac_policy(
|
||||
object_type='address_scope',
|
||||
@ -227,11 +227,11 @@ class RbacAddressScopeTest(AddressScopeTestBase):
|
||||
rbac_pol1 = self.admin_client.create_rbac_policy(
|
||||
object_type='address_scope', object_id=a_s['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client2.project_id)['rbac_policy']
|
||||
rbac_pol2 = self.admin_client.create_rbac_policy(
|
||||
object_type='address_scope', object_id=a_s['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.admin_client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.admin_client.project_id)['rbac_policy']
|
||||
res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
|
||||
'rbac_policies']
|
||||
res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
|
||||
@ -244,12 +244,12 @@ class RbacAddressScopeTest(AddressScopeTestBase):
|
||||
@decorators.idempotent_id('222a638d-819e-41a7-a3fe-550265c06e79')
|
||||
def test_regular_client_blocked_from_sharing_anothers_policy(self):
|
||||
a_s = self._make_admin_as_shared_to_project_id(
|
||||
self.client.tenant_id)['address_scope']
|
||||
self.client.project_id)['address_scope']
|
||||
with testtools.ExpectedException(lib_exc.BadRequest):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='address_scope', object_id=a_s['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
|
||||
# make sure the rbac-policy is invisible to the tenant for which it's
|
||||
# being shared
|
||||
|
@ -49,7 +49,7 @@ class NetworksTestJSON(base.BaseNetworkTest):
|
||||
fields.append('mtu')
|
||||
for key in fields:
|
||||
self.assertEqual(network[key], self.network[key])
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
self.assertEqual(project_id, network['tenant_id'])
|
||||
if utils.is_extension_enabled('project-id', 'network'):
|
||||
self.assertEqual(project_id, network['project_id'])
|
||||
@ -76,7 +76,7 @@ class NetworksTestJSON(base.BaseNetworkTest):
|
||||
@decorators.idempotent_id('0cc0552f-afaf-4231-b7a7-c2a1774616da')
|
||||
@utils.requires_ext(extension="project-id", service="network")
|
||||
def test_create_network_with_project(self):
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
|
||||
name = 'created-with-project_id'
|
||||
network = self.create_network(name, project_id=project_id)
|
||||
|
@ -86,7 +86,7 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
||||
body = self.admin_client.show_qos_policy(policy['id'])
|
||||
show_policy = body['policy']
|
||||
self.assertIn('project_id', show_policy)
|
||||
self.assertEqual(self.admin_client.tenant_id,
|
||||
self.assertEqual(self.admin_client.project_id,
|
||||
show_policy['project_id'])
|
||||
|
||||
@decorators.idempotent_id('f8d20e92-f06d-4805-b54f-230f77715815')
|
||||
@ -134,10 +134,11 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
||||
|
||||
@decorators.idempotent_id('8e88a54b-f0b2-4b7d-b061-a15d93c2c7d6')
|
||||
def test_policy_update(self):
|
||||
policy = self.create_qos_policy(name=self.policy_name,
|
||||
description='',
|
||||
shared=False,
|
||||
project_id=self.admin_client.tenant_id)
|
||||
policy = self.create_qos_policy(
|
||||
name=self.policy_name,
|
||||
description='',
|
||||
shared=False,
|
||||
project_id=self.admin_client.project_id)
|
||||
self.admin_client.update_qos_policy(policy['id'],
|
||||
description='test policy desc2',
|
||||
shared=True)
|
||||
@ -153,7 +154,7 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
||||
policy = self.create_qos_policy(name=self.policy_name,
|
||||
description='',
|
||||
shared=False,
|
||||
project_id=self.client.tenant_id)
|
||||
project_id=self.client.project_id)
|
||||
self.assertRaises(
|
||||
exceptions.Forbidden,
|
||||
self.client.update_qos_policy,
|
||||
@ -161,10 +162,11 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
||||
|
||||
@decorators.idempotent_id('4ecfd7e7-47b6-4702-be38-be9235901a87')
|
||||
def test_policy_update_forbidden_for_regular_tenants_foreign_policy(self):
|
||||
policy = self.create_qos_policy(name=self.policy_name,
|
||||
description='',
|
||||
shared=False,
|
||||
project_id=self.admin_client.tenant_id)
|
||||
policy = self.create_qos_policy(
|
||||
name=self.policy_name,
|
||||
description='',
|
||||
shared=False,
|
||||
project_id=self.admin_client.project_id)
|
||||
self.assertRaises(
|
||||
exceptions.NotFound,
|
||||
self.client.update_qos_policy,
|
||||
@ -172,10 +174,11 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
||||
|
||||
@decorators.idempotent_id('ee263db4-009a-4641-83e5-d0e83506ba4c')
|
||||
def test_shared_policy_update(self):
|
||||
policy = self.create_qos_policy(name=self.policy_name,
|
||||
description='',
|
||||
shared=True,
|
||||
project_id=self.admin_client.tenant_id)
|
||||
policy = self.create_qos_policy(
|
||||
name=self.policy_name,
|
||||
description='',
|
||||
shared=True,
|
||||
project_id=self.admin_client.project_id)
|
||||
|
||||
self.admin_client.update_qos_policy(policy['id'],
|
||||
description='test policy desc2')
|
||||
@ -396,7 +399,7 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
||||
name='test-policy-shared',
|
||||
description='shared policy',
|
||||
shared=True,
|
||||
project_id=self.admin_client.tenant_id)
|
||||
project_id=self.admin_client.project_id)
|
||||
obtained_policy = self.client.show_qos_policy(policy['id'])['policy']
|
||||
self.assertEqual(obtained_policy, policy)
|
||||
|
||||
@ -438,11 +441,11 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
||||
def test_user_create_port_with_admin_qos_policy(self):
|
||||
qos_policy = self.create_qos_policy(
|
||||
name=self.policy_name,
|
||||
project_id=self.admin_client.tenant_id,
|
||||
project_id=self.admin_client.project_id,
|
||||
shared=False)
|
||||
network = self.create_network(
|
||||
'test network', client=self.admin_client,
|
||||
project_id=self.client.tenant_id,
|
||||
project_id=self.client.project_id,
|
||||
qos_policy_id=qos_policy['id'])
|
||||
port = self.create_port(network)
|
||||
self.assertEqual(network['id'], port['network_id'])
|
||||
@ -603,7 +606,7 @@ class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
|
||||
policy = self.create_qos_policy(name=self.policy_name,
|
||||
description='test policy',
|
||||
shared=False,
|
||||
project_id=self.client.tenant_id)
|
||||
project_id=self.client.project_id)
|
||||
rule = self._create_qos_bw_limit_rule(
|
||||
policy['id'],
|
||||
{'max_kbps': 1, 'max_burst_kbps': 1})
|
||||
@ -618,7 +621,7 @@ class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
|
||||
name=self.policy_name,
|
||||
description='test policy',
|
||||
shared=False,
|
||||
project_id=self.admin_client.tenant_id)
|
||||
project_id=self.admin_client.project_id)
|
||||
rule = self._create_qos_bw_limit_rule(
|
||||
policy['id'], {'max_kbps': 1, 'max_burst_kbps': 1})
|
||||
self.assertRaises(
|
||||
@ -797,7 +800,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
qos_pol = self.create_qos_policy(
|
||||
name=data_utils.rand_name('test-policy'),
|
||||
description='test-shared-policy', shared=False,
|
||||
project_id=self.admin_client.tenant_id)
|
||||
project_id=self.admin_client.project_id)
|
||||
self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
|
||||
|
||||
# test update shared False -> True
|
||||
@ -805,8 +808,8 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
qos_pol['shared'] = True
|
||||
self.client2.show_qos_policy(qos_pol['id'])
|
||||
rbac_pol = {'target_tenant': '*',
|
||||
'tenant_id': self.admin_client.tenant_id,
|
||||
'project_id': self.admin_client.tenant_id,
|
||||
'tenant_id': self.admin_client.project_id,
|
||||
'project_id': self.admin_client.project_id,
|
||||
'object_type': 'qos_policy',
|
||||
'object_id': qos_pol['id'],
|
||||
'action': 'access_as_shared'}
|
||||
@ -829,7 +832,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
|
||||
def _create_net_bound_qos_rbacs(self):
|
||||
res = self._make_admin_policy_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
qos_policy, rbac_for_client_tenant = res['policy'], res['rbac_policy']
|
||||
|
||||
# add a wildcard rbac rule - now the policy globally shared
|
||||
@ -862,7 +865,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('2ace9adc-da6e-11e5-aafe-54ee756c66df')
|
||||
def test_policy_sharing_with_wildcard_and_project_id(self):
|
||||
res = self._make_admin_policy_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
qos_policy, rbac = res['policy'], res['rbac_policy']
|
||||
qos_pol = self.client.show_qos_policy(qos_policy['id'])['policy']
|
||||
self.assertTrue(qos_pol['shared'])
|
||||
@ -885,11 +888,11 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('9f85c76a-a350-11e5-8ae5-54ee756c66df')
|
||||
def test_policy_target_update(self):
|
||||
res = self._make_admin_policy_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
# change to client2
|
||||
update_res = self.admin_client.update_rbac_policy(
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
|
||||
self.assertEqual(self.client2.tenant_id,
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.project_id)
|
||||
self.assertEqual(self.client2.project_id,
|
||||
update_res['rbac_policy']['target_tenant'])
|
||||
# make sure everything else stayed the same
|
||||
res['rbac_policy'].pop('target_tenant')
|
||||
@ -899,7 +902,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('a9b39f46-a350-11e5-97c7-54ee756c66df')
|
||||
def test_network_presence_prevents_policy_rbac_policy_deletion(self):
|
||||
res = self._make_admin_policy_shared_to_project_id(
|
||||
self.client2.tenant_id)
|
||||
self.client2.project_id)
|
||||
qos_policy_id = res['policy']['id']
|
||||
self._create_network(qos_policy_id, self.client2)
|
||||
# a network with shared qos-policy should prevent the deletion of an
|
||||
@ -922,7 +925,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
# we can't update the policy to a different tenant
|
||||
with testtools.ExpectedException(exceptions.Conflict):
|
||||
self.admin_client.update_rbac_policy(
|
||||
wild['id'], target_tenant=self.client2.tenant_id)
|
||||
wild['id'], target_tenant=self.client2.project_id)
|
||||
|
||||
@decorators.idempotent_id('b0fe87e8-a350-11e5-9f08-54ee756c66df')
|
||||
def test_regular_client_shares_to_another_regular_client(self):
|
||||
@ -933,7 +936,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
rbac_policy = self.admin_client.create_rbac_policy(
|
||||
object_type='qos_policy', object_id=policy['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
self.client.show_qos_policy(policy['id'])
|
||||
|
||||
self.assertIn(rbac_policy,
|
||||
@ -948,7 +951,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
policy = self._create_qos_policy()
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='qos_policy', object_id=policy['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
|
||||
('project_id', 'target_tenant'))
|
||||
for fields in field_args:
|
||||
@ -958,7 +961,7 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('c10d993a-a350-11e5-9c7a-54ee756c66df')
|
||||
def test_rbac_policy_show(self):
|
||||
res = self._make_admin_policy_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
p1 = res['rbac_policy']
|
||||
p2 = self.admin_client.create_rbac_policy(
|
||||
object_type='qos_policy', object_id=res['policy']['id'],
|
||||
@ -976,11 +979,11 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
rbac_pol1 = self.admin_client.create_rbac_policy(
|
||||
object_type='qos_policy', object_id=policy['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client2.project_id)['rbac_policy']
|
||||
rbac_pol2 = self.admin_client.create_rbac_policy(
|
||||
object_type='qos_policy', object_id=policy['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.admin_client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.admin_client.project_id)['rbac_policy']
|
||||
res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
|
||||
'rbac_policies']
|
||||
res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
|
||||
@ -993,12 +996,12 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('cd7d755a-a350-11e5-a344-54ee756c66df')
|
||||
def test_regular_client_blocked_from_sharing_anothers_policy(self):
|
||||
qos_policy = self._make_admin_policy_shared_to_project_id(
|
||||
self.client.tenant_id)['policy']
|
||||
self.client.project_id)['policy']
|
||||
with testtools.ExpectedException(exceptions.BadRequest):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='qos_policy', object_id=qos_policy['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
|
||||
# make sure the rbac-policy is invisible to the tenant for which it's
|
||||
# being shared
|
||||
|
@ -344,7 +344,7 @@ class TestRevisions(base.BaseAdminNetworkTest):
|
||||
def test_update_router_extra_attributes_bumps_revision(self):
|
||||
# updates from CVR to CVR-HA are supported on every release,
|
||||
# but only the admin can forcibly create a non-HA router
|
||||
router_args = {'tenant_id': self.client.tenant_id,
|
||||
router_args = {'tenant_id': self.client.project_id,
|
||||
'ha': False}
|
||||
router = self.admin_client.create_router('r1', True,
|
||||
**router_args)['router']
|
||||
|
@ -61,7 +61,7 @@ class RouterInterfaceFip(base.BaseAdminNetworkTest):
|
||||
subnet1 = self.create_subnet(net1, cidr=cidr1)
|
||||
self.create_router_interface(router1['id'], subnet1['id'])
|
||||
net2 = self.admin_client.create_network(
|
||||
project_id=self.client.tenant_id,
|
||||
project_id=self.client.project_id,
|
||||
**{'router:external': True})['network']
|
||||
self.networks.append(net2)
|
||||
subnet2 = self.create_subnet(net2, cidr=cidr2)
|
||||
|
@ -316,7 +316,7 @@ class DvrRoutersTestToCentralized(base_routers.BaseRouterTest):
|
||||
@decorators.idempotent_id('644d7a4a-01a1-4b68-bb8d-0c0042cb1729')
|
||||
def test_convert_distributed_router_back_to_centralized(self):
|
||||
# Convert a centralized router to distributed firstly
|
||||
router_args = {'tenant_id': self.client.tenant_id,
|
||||
router_args = {'tenant_id': self.client.project_id,
|
||||
'distributed': False, 'ha': False}
|
||||
router = self._create_admin_router(
|
||||
data_utils.rand_name('router'), admin_state_up=False,
|
||||
@ -348,7 +348,7 @@ class DvrRoutersTestUpdateDistributedExtended(base_routers.BaseRouterTest):
|
||||
|
||||
@decorators.idempotent_id('0ffb9973-0c1a-4b76-a1f2-060178057661')
|
||||
def test_convert_centralized_router_to_distributed_extended(self):
|
||||
router_args = {'tenant_id': self.client.tenant_id,
|
||||
router_args = {'tenant_id': self.client.project_id,
|
||||
'distributed': False, 'ha': False}
|
||||
router = self._create_admin_router(
|
||||
data_utils.rand_name('router'), admin_state_up=True,
|
||||
@ -371,7 +371,7 @@ class DvrRoutersTestUpdateDistributedExtended(base_routers.BaseRouterTest):
|
||||
|
||||
@decorators.idempotent_id('e9a8f55b-c535-44b7-8b0a-20af6a7c2921')
|
||||
def test_convert_distributed_router_to_centralized_extended(self):
|
||||
router_args = {'tenant_id': self.client.tenant_id,
|
||||
router_args = {'tenant_id': self.client.project_id,
|
||||
'distributed': True, 'ha': False}
|
||||
router = self._create_admin_router(
|
||||
data_utils.rand_name('router'), admin_state_up=True,
|
||||
|
@ -124,7 +124,7 @@ class DvrRoutersNegativeTestExtended(RoutersNegativeTestBase):
|
||||
@decorators.idempotent_id('5379fe06-e45e-4a4f-8b4a-9e28a924b451')
|
||||
def test_router_update_distributed_returns_exception(self):
|
||||
# create a centralized router
|
||||
router_args = {'tenant_id': self.client.tenant_id,
|
||||
router_args = {'tenant_id': self.client.project_id,
|
||||
'distributed': False}
|
||||
router = self._create_admin_router(
|
||||
data_utils.rand_name('router'), admin_state_up=True,
|
||||
@ -141,7 +141,7 @@ class DvrRoutersNegativeTestExtended(RoutersNegativeTestBase):
|
||||
@decorators.idempotent_id('c277e945-3b39-442d-b149-e2e8cc6a2b40')
|
||||
def test_router_update_centralized_returns_exception(self):
|
||||
# create a centralized router
|
||||
router_args = {'tenant_id': self.client.tenant_id,
|
||||
router_args = {'tenant_id': self.client.project_id,
|
||||
'distributed': False}
|
||||
router = self._create_admin_router(
|
||||
data_utils.rand_name('router'), admin_state_up=True,
|
||||
|
@ -71,7 +71,7 @@ class BaseSecGroupTest(base.BaseAdminNetworkTest):
|
||||
protocol = random.choice(list(base_security_groups.V4_PROTOCOL_NAMES))
|
||||
security_group_rule = self.create_security_group_rule(
|
||||
security_group=security_group,
|
||||
project={'id': self.admin_client.tenant_id},
|
||||
project={'id': self.admin_client.project_id},
|
||||
client=self.admin_client,
|
||||
protocol=protocol,
|
||||
direction=constants.INGRESS_DIRECTION)
|
||||
@ -97,7 +97,7 @@ class BaseSecGroupTest(base.BaseAdminNetworkTest):
|
||||
protocol = random.choice(list(base_security_groups.V4_PROTOCOL_NAMES))
|
||||
security_group_rule = self.create_security_group_rule(
|
||||
security_group=security_group,
|
||||
project={'id': self.admin_client.tenant_id},
|
||||
project={'id': self.admin_client.project_id},
|
||||
client=self.admin_client,
|
||||
protocol=protocol,
|
||||
direction=constants.INGRESS_DIRECTION)
|
||||
@ -105,7 +105,7 @@ class BaseSecGroupTest(base.BaseAdminNetworkTest):
|
||||
# Create also other SG with some custom rule to check that regular user
|
||||
# can't see this rule
|
||||
sg_kwargs = {
|
||||
'project': {'id': self.admin_client.tenant_id},
|
||||
'project': {'id': self.admin_client.project_id},
|
||||
'client': self.admin_client
|
||||
}
|
||||
if self.stateless_sg:
|
||||
@ -113,7 +113,7 @@ class BaseSecGroupTest(base.BaseAdminNetworkTest):
|
||||
admin_security_group = self.create_security_group(**sg_kwargs)
|
||||
admin_security_group_rule = self.create_security_group_rule(
|
||||
security_group=admin_security_group,
|
||||
project={'id': self.admin_client.tenant_id},
|
||||
project={'id': self.admin_client.project_id},
|
||||
client=self.admin_client,
|
||||
protocol=protocol,
|
||||
direction=constants.INGRESS_DIRECTION)
|
||||
@ -272,18 +272,18 @@ class BaseSecGroupQuota(base.BaseAdminNetworkTest):
|
||||
|
||||
def _set_sg_quota(self, val):
|
||||
sg_quota = self._get_sg_quota()
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
self.admin_client.update_quotas(project_id, **{'security_group': val})
|
||||
self.addCleanup(self.admin_client.update_quotas,
|
||||
project_id, **{'security_group': sg_quota})
|
||||
|
||||
def _get_sg_quota(self):
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
quotas = self.admin_client.show_quotas(project_id)
|
||||
return quotas['quota']['security_group']
|
||||
|
||||
def _get_sg_amount(self):
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
filter_query = {'project_id': project_id}
|
||||
security_groups = self.client.list_security_groups(**filter_query)
|
||||
return len(security_groups['security_groups'])
|
||||
@ -341,7 +341,7 @@ class BaseSecGroupRulesQuota(base.BaseAdminNetworkTest):
|
||||
def _create_security_group_rules(self, amount, port_index=1):
|
||||
for i in range(amount):
|
||||
ingress_rule = self.create_security_group_rule(**{
|
||||
'project_id': self.client.tenant_id,
|
||||
'project_id': self.client.project_id,
|
||||
'direction': 'ingress',
|
||||
'port_range_max': port_index + i,
|
||||
'port_range_min': port_index + i,
|
||||
@ -364,18 +364,18 @@ class BaseSecGroupRulesQuota(base.BaseAdminNetworkTest):
|
||||
return new_sg_rules_quota
|
||||
|
||||
def _set_sg_rules_quota(self, val):
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
self.admin_client.update_quotas(project_id,
|
||||
**{'security_group_rule': val})
|
||||
LOG.info('Trying to update security group rule quota {} '.format(val))
|
||||
|
||||
def _get_sg_rules_quota(self):
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
quotas = self.admin_client.show_quotas(project_id)
|
||||
return quotas['quota']['security_group_rule']
|
||||
|
||||
def _get_sg_rules_amount(self):
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
filter_query = {'project_id': project_id}
|
||||
security_group_rules = self.client.list_security_group_rules(
|
||||
**filter_query)
|
||||
@ -390,7 +390,7 @@ class SecGroupRulesQuotaTest(BaseSecGroupRulesQuota):
|
||||
def setUp(self):
|
||||
super(SecGroupRulesQuotaTest, self).setUp()
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_client.reset_quotas, self.client.tenant_id)
|
||||
self.admin_client.reset_quotas, self.client.project_id)
|
||||
self._set_sg_rules_quota(10)
|
||||
|
||||
@decorators.idempotent_id('77ec038c-5638-11ea-8e2d-0242ac130003')
|
||||
@ -416,7 +416,7 @@ class SecGroupRulesQuotaTest(BaseSecGroupRulesQuota):
|
||||
values, different values.
|
||||
"""
|
||||
sg_rules_quota = self._get_sg_rules_quota()
|
||||
project_id = self.client.tenant_id
|
||||
project_id = self.client.project_id
|
||||
self.addCleanup(self.admin_client.update_quotas,
|
||||
project_id, **{'security_group_rule': sg_rules_quota})
|
||||
values = [-1, 0, 10, 2147483647]
|
||||
@ -569,7 +569,7 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
def _create_security_group(self):
|
||||
return self.create_security_group(
|
||||
name=data_utils.rand_name('test-sg'),
|
||||
project={'id': self.admin_client.tenant_id})
|
||||
project={'id': self.admin_client.project_id})
|
||||
|
||||
def _make_admin_sg_shared_to_project_id(self, project_id):
|
||||
sg = self._create_security_group()
|
||||
@ -584,11 +584,11 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('2a41eb8f-2a35-11e9-bae9-acde48001122')
|
||||
def test_policy_target_update(self):
|
||||
res = self._make_admin_sg_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
# change to client2
|
||||
update_res = self.admin_client.update_rbac_policy(
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
|
||||
self.assertEqual(self.client2.tenant_id,
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.project_id)
|
||||
self.assertEqual(self.client2.project_id,
|
||||
update_res['rbac_policy']['target_tenant'])
|
||||
# make sure everything else stayed the same
|
||||
res['rbac_policy'].pop('target_tenant')
|
||||
@ -598,7 +598,7 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('2a619a8a-2a35-11e9-90d9-acde48001122')
|
||||
def test_port_presence_prevents_policy_rbac_policy_deletion(self):
|
||||
res = self._make_admin_sg_shared_to_project_id(
|
||||
self.client2.tenant_id)
|
||||
self.client2.project_id)
|
||||
sg_id = res['security_group']['id']
|
||||
net = self.create_network(client=self.client2)
|
||||
port = self.client2.create_port(
|
||||
@ -623,7 +623,7 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
rbac_policy = self.admin_client.create_rbac_policy(
|
||||
object_type='security_group', object_id=sg['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
self.client.show_security_group(sg['id'])
|
||||
|
||||
self.assertIn(rbac_policy,
|
||||
@ -638,7 +638,7 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
sg = self._create_security_group()
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='security_group', object_id=sg['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
|
||||
('project_id', 'target_tenant'))
|
||||
for fields in field_args:
|
||||
@ -648,7 +648,7 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('2abf8f9e-2a35-11e9-85f7-acde48001122')
|
||||
def test_rbac_policy_show(self):
|
||||
res = self._make_admin_sg_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
p1 = res['rbac_policy']
|
||||
p2 = self.admin_client.create_rbac_policy(
|
||||
object_type='security_group',
|
||||
@ -667,11 +667,11 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
rbac_pol1 = self.admin_client.create_rbac_policy(
|
||||
object_type='security_group', object_id=sg['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client2.project_id)['rbac_policy']
|
||||
rbac_pol2 = self.admin_client.create_rbac_policy(
|
||||
object_type='security_group', object_id=sg['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.admin_client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.admin_client.project_id)['rbac_policy']
|
||||
res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
|
||||
'rbac_policies']
|
||||
res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
|
||||
@ -684,12 +684,12 @@ class RbacSharedSecurityGroupTest(base.BaseAdminNetworkTest):
|
||||
@decorators.idempotent_id('2aff3900-2a35-11e9-96b3-acde48001122')
|
||||
def test_regular_client_blocked_from_sharing_anothers_policy(self):
|
||||
sg = self._make_admin_sg_shared_to_project_id(
|
||||
self.client.tenant_id)['security_group']
|
||||
self.client.project_id)['security_group']
|
||||
with testtools.ExpectedException(exceptions.BadRequest):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='security_group', object_id=sg['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
|
||||
# make sure the rbac-policy is invisible to the tenant for which it's
|
||||
# being shared
|
||||
|
@ -182,7 +182,7 @@ class NegativeSecGroupRulesQuotaTest(
|
||||
def setUp(self):
|
||||
super(NegativeSecGroupRulesQuotaTest, self).setUp()
|
||||
self.addCleanup(test_utils.call_and_ignore_notfound_exc,
|
||||
self.admin_client.reset_quotas, self.client.tenant_id)
|
||||
self.admin_client.reset_quotas, self.client.project_id)
|
||||
self._set_sg_rules_quota(10)
|
||||
|
||||
@decorators.idempotent_id('8336e6ea-2e0a-4a1a-8673-a6f81b577d57')
|
||||
|
@ -145,8 +145,8 @@ class SubnetPoolsTest(SubnetPoolsTestBase):
|
||||
show_subnetpool = body['subnetpool']
|
||||
self.assertIn('project_id', show_subnetpool)
|
||||
self.assertIn('tenant_id', show_subnetpool)
|
||||
self.assertEqual(self.client.tenant_id, show_subnetpool['project_id'])
|
||||
self.assertEqual(self.client.tenant_id, show_subnetpool['tenant_id'])
|
||||
self.assertEqual(self.client.project_id, show_subnetpool['project_id'])
|
||||
self.assertEqual(self.client.project_id, show_subnetpool['tenant_id'])
|
||||
|
||||
@decorators.idempotent_id('764f1b93-1c4a-4513-9e7b-6c2fc5e9270c')
|
||||
def test_tenant_update_subnetpool(self):
|
||||
@ -446,11 +446,11 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
@decorators.idempotent_id('71b35ad0-51cd-40da-985d-89a51c95ec6a')
|
||||
def test_policy_target_update(self):
|
||||
res = self._make_admin_snp_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
# change to client2
|
||||
update_res = self.admin_client.update_rbac_policy(
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.tenant_id)
|
||||
self.assertEqual(self.client2.tenant_id,
|
||||
res['rbac_policy']['id'], target_tenant=self.client2.project_id)
|
||||
self.assertEqual(self.client2.project_id,
|
||||
update_res['rbac_policy']['target_tenant'])
|
||||
# make sure everything else stayed the same
|
||||
res['rbac_policy'].pop('target_tenant')
|
||||
@ -460,7 +460,7 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
@decorators.idempotent_id('451d9d38-65a0-4916-a805-1460d6a938d1')
|
||||
def test_subnet_presence_prevents_rbac_policy_deletion(self):
|
||||
res = self._make_admin_snp_shared_to_project_id(
|
||||
self.client2.tenant_id)
|
||||
self.client2.project_id)
|
||||
network = self.create_network(client=self.client2)
|
||||
subnet = self.client2.create_subnet(
|
||||
network_id=network['id'],
|
||||
@ -491,7 +491,7 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
rbac_policy = self.admin_client.create_rbac_policy(
|
||||
object_type='address_scope', object_id=a_s['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
|
||||
# Create subnet pool owned by client with shared AS
|
||||
snp = self._create_subnetpool(address_scope_id=a_s["id"])
|
||||
@ -500,7 +500,7 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='subnetpool', object_id=snp['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id
|
||||
target_tenant=self.client2.project_id
|
||||
)
|
||||
|
||||
# cleanup
|
||||
@ -517,7 +517,7 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
rbac_policy = self.admin_client.create_rbac_policy(
|
||||
object_type='subnetpool', object_id=snp['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client.project_id)['rbac_policy']
|
||||
self.client.show_subnetpool(snp['id'])
|
||||
|
||||
self.assertIn(rbac_policy,
|
||||
@ -532,7 +532,7 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
snp = self._create_subnetpool()
|
||||
self.admin_client.create_rbac_policy(
|
||||
object_type='subnetpool', object_id=snp['id'],
|
||||
action='access_as_shared', target_tenant=self.client2.tenant_id)
|
||||
action='access_as_shared', target_tenant=self.client2.project_id)
|
||||
field_args = (('id',), ('id', 'action'), ('object_type', 'object_id'),
|
||||
('project_id', 'target_tenant'))
|
||||
for fields in field_args:
|
||||
@ -542,7 +542,7 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
@decorators.idempotent_id('e59e4502-4e6a-4e49-b446-a5d5642bbd69')
|
||||
def test_rbac_policy_show(self):
|
||||
res = self._make_admin_snp_shared_to_project_id(
|
||||
self.client.tenant_id)
|
||||
self.client.project_id)
|
||||
p1 = res['rbac_policy']
|
||||
p2 = self.admin_client.create_rbac_policy(
|
||||
object_type='subnetpool',
|
||||
@ -561,11 +561,11 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
rbac_pol1 = self.admin_client.create_rbac_policy(
|
||||
object_type='subnetpool', object_id=snp['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)['rbac_policy']
|
||||
target_tenant=self.client2.project_id)['rbac_policy']
|
||||
rbac_pol2 = self.admin_client.create_rbac_policy(
|
||||
object_type='subnetpool', object_id=snp['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.admin_client.tenant_id)['rbac_policy']
|
||||
target_tenant=self.admin_client.project_id)['rbac_policy']
|
||||
res1 = self.admin_client.list_rbac_policies(id=rbac_pol1['id'])[
|
||||
'rbac_policies']
|
||||
res2 = self.admin_client.list_rbac_policies(id=rbac_pol2['id'])[
|
||||
@ -578,12 +578,12 @@ class RbacSubnetPoolTest(SubnetPoolsTestBase):
|
||||
@decorators.idempotent_id('63d9acbe-403c-4e77-9ffd-80e636a4621e')
|
||||
def test_regular_client_blocked_from_sharing_anothers_policy(self):
|
||||
snp = self._make_admin_snp_shared_to_project_id(
|
||||
self.client.tenant_id)['subnetpool']
|
||||
self.client.project_id)['subnetpool']
|
||||
with testtools.ExpectedException(lib_exc.BadRequest):
|
||||
self.client.create_rbac_policy(
|
||||
object_type='subnetpool', object_id=snp['id'],
|
||||
action='access_as_shared',
|
||||
target_tenant=self.client2.tenant_id)
|
||||
target_tenant=self.client2.project_id)
|
||||
|
||||
# make sure the rbac-policy is invisible to the tenant for which it's
|
||||
# being shared
|
||||
|
@ -289,5 +289,5 @@ class SubnetPoolsNegativeTestJSON(test_subnetpools.SubnetPoolsTestBase):
|
||||
lib_exc.BadRequest,
|
||||
self.admin_client.update_subnetpool,
|
||||
subnetpool['id'],
|
||||
tenant_id=self.admin_client.tenant_id,
|
||||
tenant_id=self.admin_client.project_id,
|
||||
)
|
||||
|
@ -48,7 +48,7 @@ class TrunkTestJSONBase(base.BaseAdminNetworkTest):
|
||||
if parent_network_type:
|
||||
client = cls.admin_client
|
||||
network_kwargs = {"provider:network_type": parent_network_type,
|
||||
"tenant_id": cls.client.tenant_id}
|
||||
"tenant_id": cls.client.project_id}
|
||||
network = cls.create_network(client=client, **network_kwargs)
|
||||
parent_port = cls.create_port(network)
|
||||
return cls.create_trunk(parent_port, subports, **kwargs)
|
||||
@ -98,7 +98,7 @@ class TrunkTestJSON(TrunkTestJSONBase):
|
||||
observed_trunk = self._show_trunk(trunk)
|
||||
for key in ['project_id', 'tenant_id']:
|
||||
self.assertIn(key, observed_trunk)
|
||||
self.assertEqual(self.client.tenant_id, observed_trunk[key])
|
||||
self.assertEqual(self.client.project_id, observed_trunk[key])
|
||||
|
||||
@decorators.idempotent_id('4ce46c22-a2b6-4659-bc5a-0ef2463cab32')
|
||||
def test_create_update_trunk(self):
|
||||
|
@ -54,21 +54,21 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('709b23b0-9719-47df-9f53-b0812a5d5a48')
|
||||
def test_delete_bgpvpn(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
self.delete_bgpvpn(self.bgpvpn_admin_client, bgpvpn)
|
||||
|
||||
@decorators.attr(type=['negative'])
|
||||
@decorators.idempotent_id('596abfc2-fd89-491d-863d-25459db1df4b')
|
||||
def test_delete_bgpvpn_as_non_admin_fail(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
self.assertRaises(exceptions.Forbidden,
|
||||
self.bgpvpn_client.delete_bgpvpn, bgpvpn['id'])
|
||||
|
||||
@decorators.idempotent_id('9fa29db8-35d0-4beb-a986-23c369499ab1')
|
||||
def test_show_bgpvpn(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
bgpvpn_details = self.bgpvpn_client.show_bgpvpn(bgpvpn['id'])['bgpvpn']
|
||||
self.assertEqual(bgpvpn['id'], bgpvpn_details['id'])
|
||||
|
||||
@ -76,14 +76,14 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('b20110bb-393b-4342-8b30-6486cd2b4fc6')
|
||||
def test_show_bgpvpn_as_non_owner_fail(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
self.assertRaises(exceptions.NotFound,
|
||||
self.bgpvpn_alt_client.show_bgpvpn, bgpvpn['id'])
|
||||
|
||||
@decorators.idempotent_id('7a7feca2-1c24-4f5d-ad4b-b0e5a712adb1')
|
||||
def test_list_bgpvpn(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
bgpvpns = self.bgpvpn_client.list_bgpvpns()['bgpvpns']
|
||||
self.assertIn(bgpvpn['id'],
|
||||
[bgpvpn_alt['id'] for bgpvpn_alt in bgpvpns])
|
||||
@ -92,7 +92,7 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('4875e65d-0b65-40c0-9efd-309420686ab4')
|
||||
def test_list_bgpvpn_as_non_owner_fail(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
bgpvpns_alt = self.bgpvpn_alt_client.list_bgpvpns()['bgpvpns']
|
||||
self.assertNotIn(bgpvpn['id'],
|
||||
[bgpvpn_alt['id'] for bgpvpn_alt in bgpvpns_alt])
|
||||
@ -100,7 +100,7 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('096281da-356d-4c04-bd55-784a26bb1b0c')
|
||||
def test_list_show_network_association(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
network = self.networks_client.create_network()['network']
|
||||
|
||||
association = self.bgpvpn_client.create_network_association(
|
||||
@ -118,7 +118,7 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('57b0da93-8e37-459f-9aaf-f903acc36025')
|
||||
def test_show_netassoc_as_non_owner_fail(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
network = self.networks_client.create_network()['network']
|
||||
|
||||
net_assoc = self.bgpvpn_client.create_network_association(
|
||||
@ -132,7 +132,7 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('2cbb10af-bf9c-4b32-b6a6-4066de783758')
|
||||
def test_list_netassoc_as_non_owner_fail(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
network = self.networks_client.create_network()['network']
|
||||
|
||||
self.bgpvpn_client.create_network_association(bgpvpn['id'],
|
||||
@ -144,7 +144,7 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('51e1b079-aefa-4c37-8b1a-0567b3ef7954')
|
||||
def test_associate_disassociate_network(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
network = self.networks_client.create_network()
|
||||
network_id = network['network']['id']
|
||||
|
||||
@ -187,7 +187,7 @@ class BgpvpnTest(base):
|
||||
def test_update_route_target_non_admin_fail(self):
|
||||
bgpvpn = self.create_bgpvpn(
|
||||
self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id,
|
||||
tenant_id=self.bgpvpn_client.project_id,
|
||||
route_targets=['64512:1'])
|
||||
with ExpectedException(exceptions.Forbidden):
|
||||
self.bgpvpn_client.update_bgpvpn(
|
||||
@ -206,21 +206,21 @@ class BgpvpnTest(base):
|
||||
"""
|
||||
postdata = {
|
||||
"name": "testbgpvpn",
|
||||
"tenant_id": self.bgpvpn_client.tenant_id,
|
||||
"tenant_id": self.bgpvpn_client.project_id,
|
||||
"route_targets": ["0"]
|
||||
}
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.bgpvpn_admin_client.create_bgpvpn, **postdata)
|
||||
postdata = {
|
||||
"name": "testbgpvpn",
|
||||
"tenant_id": self.bgpvpn_client.tenant_id,
|
||||
"tenant_id": self.bgpvpn_client.project_id,
|
||||
"import_targets": ["test", " "]
|
||||
}
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
self.bgpvpn_admin_client.create_bgpvpn, **postdata)
|
||||
postdata = {
|
||||
"name": "testbgpvpn",
|
||||
"tenant_id": self.bgpvpn_client.tenant_id,
|
||||
"tenant_id": self.bgpvpn_client.project_id,
|
||||
"export_targets": ["64512:1000000000000", "xyz"]
|
||||
}
|
||||
self.assertRaises(exceptions.BadRequest,
|
||||
@ -236,7 +236,7 @@ class BgpvpnTest(base):
|
||||
"""
|
||||
postdata = {
|
||||
"name": "testbgpvpn",
|
||||
"tenant_id": self.bgpvpn_client.tenant_id,
|
||||
"tenant_id": self.bgpvpn_client.project_id,
|
||||
}
|
||||
bgpvpn = self.bgpvpn_admin_client.create_bgpvpn(**postdata)
|
||||
updatedata = {
|
||||
@ -268,7 +268,7 @@ class BgpvpnTest(base):
|
||||
"""
|
||||
postdata = {
|
||||
"name": "testbgpvpn",
|
||||
"tenant_id": self.bgpvpn_client.tenant_id,
|
||||
"tenant_id": self.bgpvpn_client.project_id,
|
||||
}
|
||||
bgpvpn = self.bgpvpn_admin_client.create_bgpvpn(**postdata)
|
||||
network = self.networks_client.create_network()
|
||||
@ -290,7 +290,7 @@ class BgpvpnTest(base):
|
||||
"""
|
||||
postdata = {
|
||||
"name": "testbgpvpn",
|
||||
"tenant_id": self.bgpvpn_client.tenant_id,
|
||||
"tenant_id": self.bgpvpn_client.project_id,
|
||||
}
|
||||
bgpvpn = self.bgpvpn_admin_client.create_bgpvpn(**postdata)
|
||||
network = self.networks_client.create_network()
|
||||
@ -310,7 +310,7 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('de8d94b0-0239-4a48-9574-c3a4a4f7cacb')
|
||||
def test_associate_disassociate_router(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
router = self.routers_client.create_router()
|
||||
router_id = router['router']['id']
|
||||
|
||||
@ -334,7 +334,7 @@ class BgpvpnTest(base):
|
||||
@decorators.idempotent_id('3ae91755-b1b6-4c62-a699-a44eeb4ee522')
|
||||
def test_list_show_router_association(self):
|
||||
bgpvpn = self.create_bgpvpn(self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
router = self.routers_client.create_router()
|
||||
router_id = router['router']['id']
|
||||
|
||||
@ -355,7 +355,7 @@ class BgpvpnTest(base):
|
||||
# Create a first bgpvpn and associate a network with a subnet to it
|
||||
bgpvpn_net = self.create_bgpvpn(
|
||||
self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
network = self.create_network()
|
||||
subnet = self.create_subnet(network)
|
||||
self.bgpvpn_client.create_network_association(
|
||||
@ -364,7 +364,7 @@ class BgpvpnTest(base):
|
||||
# Create a second bgpvpn and associate a router to it
|
||||
bgpvpn_router = self.create_bgpvpn(
|
||||
self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_client.tenant_id)
|
||||
tenant_id=self.bgpvpn_client.project_id)
|
||||
|
||||
router = self.create_router(
|
||||
router_name=data_utils.rand_name('test-bgpvpn-'))
|
||||
|
@ -149,7 +149,7 @@ class NetworkScenarioTest(ScenarioTest):
|
||||
if not client:
|
||||
client = self.admin_routers_client
|
||||
if not tenant_id:
|
||||
tenant_id = client.tenant_id
|
||||
tenant_id = client.project_id
|
||||
name = data_utils.rand_name(namestart)
|
||||
result = client.create_router(name=name,
|
||||
admin_state_up=True,
|
||||
|
@ -1253,7 +1253,7 @@ class TestBGPVPNBasic(base.BaseBgpvpnTest, manager.NetworkScenarioTest):
|
||||
export_rts = export_rts or []
|
||||
self.bgpvpn = self.create_bgpvpn(
|
||||
self.bgpvpn_admin_client,
|
||||
tenant_id=self.bgpvpn_admin_client.tenant_id,
|
||||
tenant_id=self.bgpvpn_admin_client.project_id,
|
||||
name=name, route_targets=rts, export_targets=export_rts,
|
||||
import_targets=import_rts)
|
||||
return self.bgpvpn
|
||||
|
@ -67,7 +67,7 @@ class NetworkScenarioTest(ScenarioTest):
|
||||
if not client:
|
||||
client = self.routers_client
|
||||
if not tenant_id:
|
||||
tenant_id = client.tenant_id
|
||||
tenant_id = client.project_id
|
||||
name = data_utils.rand_name(namestart)
|
||||
result = client.create_router(name=name,
|
||||
admin_state_up=True,
|
||||
|
@ -127,7 +127,7 @@ class Bgp(BgpClientMixin, base.BaseTempestTestCase):
|
||||
admin_state_up=True,
|
||||
external_network_id=CONF.network.public_network_id,
|
||||
enable_snat=False,
|
||||
project_id=cls.os_primary.network_client.tenant_id)
|
||||
project_id=cls.os_primary.network_client.project_id)
|
||||
network = cls.create_network(network_name='right-network')
|
||||
subnet = cls.create_subnet(
|
||||
network,
|
||||
|
@ -651,7 +651,7 @@ class BaseTempestTestCase(base_api.BaseNetworkTest):
|
||||
if not client:
|
||||
client = self.client
|
||||
if not tenant_id:
|
||||
tenant_id = client.tenant_id
|
||||
tenant_id = client.project_id
|
||||
router_id = CONF.network.public_router_id
|
||||
network_id = CONF.network.public_network_id
|
||||
if router_id:
|
||||
|
@ -211,7 +211,7 @@ class NetworkConnectivityTest(base.BaseTempestTestCase):
|
||||
network, cidr=str(subnet_cidr), gateway=str(gw_ip))
|
||||
|
||||
non_dvr_router = self.create_router_by_client(
|
||||
tenant_id=self.client.tenant_id,
|
||||
tenant_id=self.client.project_id,
|
||||
is_admin=True,
|
||||
router_name=data_utils.rand_name("nondvr-2-routers-same-network"),
|
||||
admin_state_up=True,
|
||||
@ -219,7 +219,7 @@ class NetworkConnectivityTest(base.BaseTempestTestCase):
|
||||
self.create_router_interface(non_dvr_router['id'], subnet['id'])
|
||||
|
||||
dvr_router = self.create_router_by_client(
|
||||
tenant_id=self.client.tenant_id,
|
||||
tenant_id=self.client.project_id,
|
||||
is_admin=True,
|
||||
router_name=data_utils.rand_name("dvr-2-rotuers-same-network"),
|
||||
admin_state_up=True,
|
||||
|
@ -218,7 +218,7 @@ class DNSIntegrationDomainPerProjectTests(BaseDNSIntegrationTests):
|
||||
|
||||
name = data_utils.rand_name('test-domain')
|
||||
zone_name = "%s.%s.%s.zone." % (cls.client.user_id,
|
||||
cls.client.tenant_id,
|
||||
cls.client.project_id,
|
||||
name)
|
||||
dns_domain_template = "<user_id>.<project_id>.%s.zone." % name
|
||||
|
||||
|
@ -64,7 +64,7 @@ class NetworkDvrTest(base.BaseTempestTestCase, NetworkTestMixin):
|
||||
The test is done by putting the SNAT port down on controller node.
|
||||
"""
|
||||
router = self.create_router_by_client(
|
||||
distributed=True, tenant_id=self.client.tenant_id, is_admin=True,
|
||||
distributed=True, tenant_id=self.client.project_id, is_admin=True,
|
||||
ha=False)
|
||||
self.setup_network_and_server(router=router)
|
||||
self._check_snat_port_connectivity()
|
||||
|
@ -125,7 +125,7 @@ class NetworkMigrationTestBase(base.BaseTempestTestCase,
|
||||
def _test_migration(self, before_dvr, before_ha, after_dvr, after_ha):
|
||||
router = self.create_router_by_client(
|
||||
distributed=before_dvr, ha=before_ha,
|
||||
tenant_id=self.client.tenant_id, is_admin=True)
|
||||
tenant_id=self.client.project_id, is_admin=True)
|
||||
|
||||
self.setup_network_and_server(router=router)
|
||||
self._wait_until_router_ports_ready(
|
||||
|
@ -101,7 +101,7 @@ class NetworkMtuTest(NetworkMtuBaseTest):
|
||||
|
||||
def _create_setup(self):
|
||||
self.admin_client = self.os_admin.network_client
|
||||
net_kwargs = {'tenant_id': self.client.tenant_id}
|
||||
net_kwargs = {'tenant_id': self.client.project_id}
|
||||
for net_type in ['vxlan', 'gre']:
|
||||
net_kwargs['name'] = '-'.join([net_type, 'net'])
|
||||
net_kwargs['provider:network_type'] = net_type
|
||||
@ -186,7 +186,7 @@ class NetworkWritableMtuTest(NetworkMtuBaseTest):
|
||||
def _create_setup(self):
|
||||
self.admin_client = self.os_admin.network_client
|
||||
for test_net in self._get_network_params():
|
||||
test_net['tenant_id'] = self.client.tenant_id
|
||||
test_net['tenant_id'] = self.client.project_id
|
||||
test_net['name'] = data_utils.rand_name('net')
|
||||
cidr = None if 'cidr' not in test_net else test_net.pop('cidr')
|
||||
network = self.admin_client.create_network(**test_net)[
|
||||
|
@ -89,7 +89,7 @@ class NetworkScenarioTest(ScenarioTest):
|
||||
if not client:
|
||||
client = self.routers_client
|
||||
if not tenant_id:
|
||||
tenant_id = client.tenant_id
|
||||
tenant_id = client.project_id
|
||||
name = data_utils.rand_name(namestart)
|
||||
result = client.create_router(name=name,
|
||||
admin_state_up=True,
|
||||
|
@ -82,7 +82,7 @@ class TestTaaS(manager.BaseTaasScenarioTests):
|
||||
if not networks_client:
|
||||
networks_client = self.networks_client
|
||||
if not tenant_id:
|
||||
tenant_id = networks_client.tenant_id
|
||||
tenant_id = networks_client.project_id
|
||||
name = data_utils.rand_name(namestart)
|
||||
network_kwargs = dict(name=name, tenant_id=tenant_id)
|
||||
# Neutron disables port security by default so we have to check the
|
||||
|
@ -137,7 +137,7 @@ class VPNaaSTestJSON(base.BaseAdminNetworkTest):
|
||||
|
||||
def _get_tenant_id(self):
|
||||
"""Returns the tenant_id of the client current user"""
|
||||
return self.client.tenant_id
|
||||
return self.client.project_id
|
||||
|
||||
@decorators.attr(type='smoke')
|
||||
@decorators.idempotent_id('74dcf2d3-a40e-4a6c-a25a-747d764bee81')
|
||||
|
Loading…
Reference in New Issue
Block a user