Tempest: Change tenant prefix to project

Upstream tempest has already changed the tenant keywork to
project. We need to change accordingly in our vmware_nsx_tempest
plugin.

Change-Id: I0c5bd75c735abee23e1d3a84b99514e49663afbc
This commit is contained in:
Tong Liu 2016-04-14 17:55:49 +00:00
parent f4d9367619
commit 66e09d88bf
10 changed files with 46 additions and 46 deletions

View File

@ -32,9 +32,9 @@ class DnsSearchDomainTest(base.BaseAdminNetworkTest):
network_name = data_utils.rand_name('dns-search') network_name = data_utils.rand_name('dns-search')
resp = cls.create_network(client=cls.networks_client, resp = cls.create_network(client=cls.networks_client,
name=network_name) name=network_name)
cls.tenant_network = resp.get('network', resp) cls.project_network = resp.get('network', resp)
# addCleanup() only available at instance, not at class # addCleanup() only available at instance, not at class
resp = cls.create_subnet(cls.tenant_network, resp = cls.create_subnet(cls.project_network,
name=network_name, name=network_name,
client=cls.subnets_client, client=cls.subnets_client,
dns_search_domain=cls.dns_search_domain) dns_search_domain=cls.dns_search_domain)
@ -44,7 +44,7 @@ class DnsSearchDomainTest(base.BaseAdminNetworkTest):
def resource_cleanup(cls): def resource_cleanup(cls):
# we need to cleanup resouces created at class methods # we need to cleanup resouces created at class methods
cls._try_delete_resource(cls.networks_client.delete_network, cls._try_delete_resource(cls.networks_client.delete_network,
cls.tenant_network['id']) cls.project_network['id'])
super(DnsSearchDomainTest, cls).resource_cleanup() super(DnsSearchDomainTest, cls).resource_cleanup()
def create_networks(self, network_name): def create_networks(self, network_name):
@ -103,7 +103,7 @@ class DnsSearchDomainTest(base.BaseAdminNetworkTest):
"""attach 2nd subnet to network and update its dns_search_domain.""" """attach 2nd subnet to network and update its dns_search_domain."""
subnet_name = data_utils.rand_name('upd-search-domain') subnet_name = data_utils.rand_name('upd-search-domain')
# 2nd subnet attached to a network, make sure to use different cidr # 2nd subnet attached to a network, make sure to use different cidr
resp = self.create_subnet(self.tenant_network, resp = self.create_subnet(self.project_network,
name=subnet_name, name=subnet_name,
cidr_offset=1, cidr_offset=1,
client=self.subnets_client) client=self.subnets_client)

View File

@ -62,7 +62,7 @@ class MultipleTransportZonesTest(base.BaseAdminNetworkTest):
cls.MAX_MTZ = CONF.nsxv.max_mtz cls.MAX_MTZ = CONF.nsxv.max_mtz
@classmethod @classmethod
def create_tenant_network_subnet(cls, name_prefix='mtz-project'): def create_project_network_subnet(cls, name_prefix='mtz-project'):
network_name = data_utils.rand_name(name_prefix) network_name = data_utils.rand_name(name_prefix)
resp = cls.create_network(client=cls.networks_client, resp = cls.create_network(client=cls.networks_client,
name=network_name) name=network_name)
@ -200,7 +200,7 @@ class MultipleTransportZonesTest(base.BaseAdminNetworkTest):
"""test router attached with multiple TZs and one tenant network.""" """test router attached with multiple TZs and one tenant network."""
scope_id_list = self.get_all_scope_id_list(with_default_scope=True) scope_id_list = self.get_all_scope_id_list(with_default_scope=True)
nets = {} nets = {}
net_id, net_info = self.create_tenant_network_subnet('mtz-tenant') net_id, net_info = self.create_project_network_subnet('mtz-tenant')
nets[net_id] = net_info nets[net_id] = net_info
for cidr_step in range(0, self.MAX_MTZ): for cidr_step in range(0, self.MAX_MTZ):
s_id = scope_id_list[cidr_step % len(scope_id_list)] s_id = scope_id_list[cidr_step % len(scope_id_list)]

View File

@ -55,15 +55,15 @@ class SubnetTestJSON(base.BaseAdminNetworkTest):
v2.0 of the Neutron API is assumed. It is also assumed that the following v2.0 of the Neutron API is assumed. It is also assumed that the following
options are defined in the [network] section of etc/tempest.conf: options are defined in the [network] section of etc/tempest.conf:
tenant_network_cidr with a block of cidr's from which smaller blocks project_network_cidr with a block of cidr's from which smaller blocks
can be allocated for tenant ipv4 subnets can be allocated for tenant ipv4 subnets
tenant_network_v6_cidr is the equivalent for ipv6 subnets project_network_v6_cidr is the equivalent for ipv6 subnets
tenant_network_mask_bits with the mask bits to be used to partition the project_network_mask_bits with the mask bits to be used to partition
block defined by tenant_network_cidr the block defined by project_network_cidr
tenant_network_v6_mask_bits is the equivalent for ipv6 subnets project_network_v6_mask_bits is the equivalent for ipv6 subnets
""" """
@classmethod @classmethod

View File

@ -88,9 +88,9 @@ class TopoDeployScenarioManager(manager.NetworkScenarioTest):
@classmethod @classmethod
def check_preconditions(cls): def check_preconditions(cls):
super(TopoDeployScenarioManager, cls).check_preconditions() super(TopoDeployScenarioManager, cls).check_preconditions()
if not (CONF.network.tenant_networks_reachable if not (CONF.network.project_networks_reachable
or CONF.network.public_network_id): or CONF.network.public_network_id):
msg = ('Either tenant_networks_reachable must be "true", or ' msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.') 'public_network_id must be defined.')
cls.enabled = False cls.enabled = False
raise cls.skipException(msg) raise cls.skipException(msg)
@ -247,7 +247,7 @@ class TopoDeployScenarioManager(manager.NetworkScenarioTest):
self.addCleanup(self.delete_wrapper, net_subnet.delete) self.addCleanup(self.delete_wrapper, net_subnet.delete)
return net_subnet return net_subnet
def setup_tenant_network(self, external_network_id, def setup_project_network(self, external_network_id,
client_mgr=None, client_mgr=None,
namestart=None, client=None, namestart=None, client=None,
tenant_id=None, cidr_offset=0): tenant_id=None, cidr_offset=0):

View File

@ -144,7 +144,7 @@ class TestTenantConnectivity(dmgr.TopoDeployScenarioManager):
self.security_group = self._create_security_group( self.security_group = self._create_security_group(
security_groups_client=client_mgr.security_groups_client, security_groups_client=client_mgr.security_groups_client,
client=client_mgr.network_client, namestart='deploy-connect') client=client_mgr.network_client, namestart='deploy-connect')
self.network, self.subnet, self.router = self.setup_tenant_network( self.network, self.subnet, self.router = self.setup_project_network(
self.public_network_id, namestart='deploy-connect') self.public_network_id, namestart='deploy-connect')
self.check_networks(self.network, self.subnet, self.router) self.check_networks(self.network, self.subnet, self.router)
security_groups = [{'name': self.security_group['name']}] security_groups = [{'name': self.security_group['name']}]
@ -209,13 +209,13 @@ class TestMultiTenantsNetwork(dmgr.TopoDeployScenarioManager):
def tearDown(self): def tearDown(self):
# do mini teardown if test failed already # do mini teardown if test failed already
try: try:
self.remove_tenant_network(False) self.remove_project_network(False)
except Exception: except Exception:
pass pass
super(TestMultiTenantsNetwork, self).tearDown() super(TestMultiTenantsNetwork, self).tearDown()
def remove_tenant_network(self, from_test=True): def remove_project_network(self, from_test=True):
for tn in ['green', 'red']: for tn in ['green', 'red']:
tenant = getattr(self, tn, None) tenant = getattr(self, tn, None)
if tenant and 'fip1' in tenant: if tenant and 'fip1' in tenant:
@ -234,7 +234,7 @@ class TestMultiTenantsNetwork(dmgr.TopoDeployScenarioManager):
time.sleep(dmgr.WAITTIME_AFTER_ASSOC_FLOATINGIP) time.sleep(dmgr.WAITTIME_AFTER_ASSOC_FLOATINGIP)
tenant['network'].delete() tenant['network'].delete()
def create_tenant_network_env(self, client_mgr, t_id, def create_project_network_env(self, client_mgr, t_id,
check_outside_world=True, check_outside_world=True,
cidr_offset=0): cidr_offset=0):
username, password = self.get_image_userpass() username, password = self.get_image_userpass()
@ -242,7 +242,7 @@ class TestMultiTenantsNetwork(dmgr.TopoDeployScenarioManager):
client=client_mgr.network_client, client=client_mgr.network_client,
security_groups_client=client_mgr.security_groups_client, security_groups_client=client_mgr.security_groups_client,
namestart="deploy-multi-tenant") namestart="deploy-multi-tenant")
t_network, t_subnet, t_router = self.setup_tenant_network( t_network, t_subnet, t_router = self.setup_project_network(
self.public_network_id, client_mgr, self.public_network_id, client_mgr,
namestart=("deploy-%s-tenant" % t_id), namestart=("deploy-%s-tenant" % t_id),
cidr_offset=cidr_offset) cidr_offset=cidr_offset)
@ -293,13 +293,13 @@ class TestMultiTenantsNetwork(dmgr.TopoDeployScenarioManager):
@test.services('compute', 'network') @test.services('compute', 'network')
def test_multi_tenants_network(self): def test_multi_tenants_network(self):
LOG.debug(Z_DEPLOY_TOPO, "multi tenant network") LOG.debug(Z_DEPLOY_TOPO, "multi tenant network")
self.green = self.create_tenant_network_env( self.green = self.create_project_network_env(
self.manager, 'green', True) self.manager, 'green', True)
# in multiple tenant environment, ip overlay could happen # in multiple tenant environment, ip overlay could happen
# for the 2nd tenent give it a different ip-range to # for the 2nd tenent give it a different ip-range to
# make sure private-ip at tenat-1 is not the same being # make sure private-ip at tenat-1 is not the same being
# assigned to tenant-2 # assigned to tenant-2
self.red = self.create_tenant_network_env( self.red = self.create_project_network_env(
self.alt_manager, 'red', False, cidr_offset=3) self.alt_manager, 'red', False, cidr_offset=3)
# t1 can reach t2's public interface # t1 can reach t2's public interface
is_rechable = dmgr.check_host_is_reachable( is_rechable = dmgr.check_host_is_reachable(
@ -318,7 +318,7 @@ class TestMultiTenantsNetwork(dmgr.TopoDeployScenarioManager):
not_reachable, not_reachable,
("t1:VM-A=%s SHOULD-NOT-REACH t2:VM-B=[fixed-ip %s]" % ("t1:VM-A=%s SHOULD-NOT-REACH t2:VM-B=[fixed-ip %s]" %
(str(self.green['node1']), str(self.red['node2'])))) (str(self.green['node1']), str(self.red['node2']))))
self.remove_tenant_network() self.remove_project_network()
LOG.debug(Z_DEPLOY_COMPLETED, "multi tenant network") LOG.debug(Z_DEPLOY_COMPLETED, "multi tenant network")
@ -345,12 +345,12 @@ class TestProviderRouterTenantNetwork(dmgr.TopoDeployScenarioManager):
def tearDown(self): def tearDown(self):
# do mini teardown if test failed already # do mini teardown if test failed already
try: try:
self.remove_tenant_network(False) self.remove_project_network(False)
except Exception: except Exception:
pass pass
super(TestProviderRouterTenantNetwork, self).tearDown() super(TestProviderRouterTenantNetwork, self).tearDown()
def remove_tenant_network(self, from_test=True): def remove_project_network(self, from_test=True):
for tn in ['yellow', 'blue']: for tn in ['yellow', 'blue']:
tenant = getattr(self, tn, None) tenant = getattr(self, tn, None)
if tenant and 'fip' in tenant: if tenant and 'fip' in tenant:
@ -367,7 +367,7 @@ class TestProviderRouterTenantNetwork(dmgr.TopoDeployScenarioManager):
self.p_router.unset_gateway() self.p_router.unset_gateway()
self.p_router.delete() self.p_router.delete()
def create_tenant_network_env(self, to_router, t_id, client_mgr=None, def create_project_network_env(self, to_router, t_id, client_mgr=None,
cidr_offset=0, **kwargs): cidr_offset=0, **kwargs):
namestart = "deploy-%s-tenant" % t_id namestart = "deploy-%s-tenant" % t_id
name = data_utils.rand_name(namestart) name = data_utils.rand_name(namestart)
@ -398,16 +398,16 @@ class TestProviderRouterTenantNetwork(dmgr.TopoDeployScenarioManager):
@test.idempotent_id('a31712de-33ad-4dc2-9755-1a0631a4f66a') @test.idempotent_id('a31712de-33ad-4dc2-9755-1a0631a4f66a')
@test.services('compute', 'network') @test.services('compute', 'network')
def test_provider_router_tenant_network(self): def test_provider_router_project_network(self):
# provider router owned by admin_client # provider router owned by admin_client
self.p_router = self._create_router( self.p_router = self._create_router(
client_mgr=self.admin_manager, namestart="deploy-provider-router", client_mgr=self.admin_manager, namestart="deploy-provider-router",
distributed=self.tenant_router_attrs.get('distributed'), distributed=self.tenant_router_attrs.get('distributed'),
router_type=self.tenant_router_attrs.get('router_type')) router_type=self.tenant_router_attrs.get('router_type'))
self.p_router.set_gateway(self.public_network_id) self.p_router.set_gateway(self.public_network_id)
self.yellow = self.create_tenant_network_env( self.yellow = self.create_project_network_env(
self.p_router, 'yellow', self.manager, 0) self.p_router, 'yellow', self.manager, 0)
self.blue = self.create_tenant_network_env( self.blue = self.create_project_network_env(
self.p_router, 'blue', self.alt_manager, 2) self.p_router, 'blue', self.alt_manager, 2)
username, password = self.get_image_userpass() username, password = self.get_image_userpass()
yellow = dmgr.make_node_info(self.yellow['fip'], username, password) yellow = dmgr.make_node_info(self.yellow['fip'], username, password)
@ -422,7 +422,7 @@ class TestProviderRouterTenantNetwork(dmgr.TopoDeployScenarioManager):
self.assertTrue( self.assertTrue(
is_reachable, is_reachable,
"VM-blue=%s CANNOT-REACH VM-yellow=%s" % (str(blue), str(yellow))) "VM-blue=%s CANNOT-REACH VM-yellow=%s" % (str(blue), str(yellow)))
self.remove_tenant_network() self.remove_project_network()
# exclusive router # exclusive router

View File

@ -59,7 +59,7 @@ class TestDvrBasicOps(manager.NetworkScenarioTest):
Determine which types of networks to test as follows: Determine which types of networks to test as follows:
* Configure tenant network checks (via the * Configure tenant network checks (via the
'tenant_networks_reachable' key) if the Tempest host should 'project_networks_reachable' key) if the Tempest host should
have direct connectivity to tenant networks. This is likely to have direct connectivity to tenant networks. This is likely to
be the case if Tempest is running on the same host as a be the case if Tempest is running on the same host as a
single-node devstack installation with IP namespaces disabled. single-node devstack installation with IP namespaces disabled.
@ -81,9 +81,9 @@ class TestDvrBasicOps(manager.NetworkScenarioTest):
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
super(TestDvrBasicOps, cls).skip_checks() super(TestDvrBasicOps, cls).skip_checks()
if not (CONF.network.tenant_networks_reachable if not (CONF.network.project_networks_reachable
or CONF.network.public_network_id): or CONF.network.public_network_id):
msg = ('Either tenant_networks_reachable must be "true", or ' msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.') 'public_network_id must be defined.')
raise cls.skipException(msg) raise cls.skipException(msg)
for ext in ['router', 'security-group', 'dvr']: for ext in ['router', 'security-group', 'dvr']:
@ -116,7 +116,7 @@ class TestDvrBasicOps(manager.NetworkScenarioTest):
name = data_utils.rand_name('server-smoke') name = data_utils.rand_name('server-smoke')
server = self._create_server(name, self.network, self.port_id) server = self._create_server(name, self.network, self.port_id)
self._check_tenant_network_connectivity() self._check_project_network_connectivity()
floating_ip = self.create_floating_ip(server) floating_ip = self.create_floating_ip(server)
self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server) self.floating_ip_tuple = Floating_IP_tuple(floating_ip, server)
@ -213,12 +213,12 @@ class TestDvrBasicOps(manager.NetworkScenarioTest):
def _get_server_key(self, server): def _get_server_key(self, server):
return self.keypairs[server['key_name']]['private_key'] return self.keypairs[server['key_name']]['private_key']
def _check_tenant_network_connectivity(self): def _check_project_network_connectivity(self):
ssh_login = CONF.validation.image_ssh_user ssh_login = CONF.validation.image_ssh_user
for server in self.servers: for server in self.servers:
# call the common method in the parent class # call the common method in the parent class
super(TestDvrBasicOps, self).\ super(TestDvrBasicOps, self).\
_check_tenant_network_connectivity( _check_project_network_connectivity(
server, ssh_login, self._get_server_key(server), server, ssh_login, self._get_server_key(server),
servers_for_debug=self.servers) servers_for_debug=self.servers)

View File

@ -44,9 +44,9 @@ class TestMultipleTransportZonesBasicOps(dmgr.TopoDeployScenarioManager):
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
super(TestMultipleTransportZonesBasicOps, cls).skip_checks() super(TestMultipleTransportZonesBasicOps, cls).skip_checks()
if not (CONF.network.tenant_networks_reachable if not (CONF.network.project_networks_reachable
or CONF.network.public_network_id): or CONF.network.public_network_id):
msg = ('Either tenant_networks_reachable must be "true", or ' msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.') 'public_network_id must be defined.')
raise cls.skipException(msg) raise cls.skipException(msg)
for ext in ['router', 'provider']: for ext in ['router', 'provider']:
@ -90,7 +90,7 @@ class TestMultipleTransportZonesBasicOps(dmgr.TopoDeployScenarioManager):
pass pass
return scope_id_list return scope_id_list
def create_tenant_network_subnet(self, def create_project_network_subnet(self,
name_prefix='mtz-project'): name_prefix='mtz-project'):
network_name = data_utils.rand_name(name_prefix) network_name = data_utils.rand_name(name_prefix)
network, subnet = self.create_network_subnet( network, subnet = self.create_network_subnet(
@ -156,7 +156,7 @@ class TestMultipleTransportZonesBasicOps(dmgr.TopoDeployScenarioManager):
"""router attached with multiple TZs and one tenant network.""" """router attached with multiple TZs and one tenant network."""
scope_id_list = self.get_all_scope_id_list(with_default_scope=True) scope_id_list = self.get_all_scope_id_list(with_default_scope=True)
nets = {} nets = {}
net_id, network, subnet = self.create_tenant_network_subnet( net_id, network, subnet = self.create_project_network_subnet(
'mtz-tenant') 'mtz-tenant')
# create security_group with loginable rules # create security_group with loginable rules
security_group = self._create_security_group( security_group = self._create_security_group(

View File

@ -53,8 +53,8 @@ class TestLBaaSBasicOps(manager.NetworkScenarioTest):
if not test.is_extension_enabled('lbaas', 'network'): if not test.is_extension_enabled('lbaas', 'network'):
msg = 'LBaaS Extension is not enabled' msg = 'LBaaS Extension is not enabled'
raise cls.skipException(msg) raise cls.skipException(msg)
if not (cfg.tenant_networks_reachable or cfg.public_network_id): if not (cfg.project_networks_reachable or cfg.public_network_id):
msg = ('Either tenant_networks_reachable must be "true", or ' msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.') 'public_network_id must be defined.')
raise cls.skipException(msg) raise cls.skipException(msg)
@ -214,7 +214,7 @@ class TestLBaaSBasicOps(manager.NetworkScenarioTest):
serv_id = server['id'] serv_id = server['id']
self.servers_keypairs[serv_id] = keypair self.servers_keypairs[serv_id] = keypair
if (CONF.network.public_network_id and not if (CONF.network.public_network_id and not
CONF.network.tenant_networks_reachable): CONF.network.project_networks_reachable):
public_network_id = CONF.network.public_network_id public_network_id = CONF.network.public_network_id
floating_ip = self.create_floating_ip( floating_ip = self.create_floating_ip(
server, public_network_id) server, public_network_id)
@ -378,7 +378,7 @@ class TestLBaaSBasicOps(manager.NetworkScenarioTest):
pool_id=self.pool.id) pool_id=self.pool.id)
self.vip.wait_for_status('ACTIVE') self.vip.wait_for_status('ACTIVE')
if (CONF.network.public_network_id and not if (CONF.network.public_network_id and not
CONF.network.tenant_networks_reachable): CONF.network.project_networks_reachable):
self._assign_floating_ip_to_vip(self.vip) self._assign_floating_ip_to_vip(self.vip)
self.vip_ip = self.floating_ips[ self.vip_ip = self.floating_ips[
self.vip.id][0]['floating_ip_address'] self.vip.id][0]['floating_ip_address']

View File

@ -34,7 +34,7 @@ NSX_FIREWALL_REALIZED_DELAY = 2
class NSXv3SecGroupTest(base.BaseSecGroupTest): class NSXv3SecGroupTest(base.BaseSecGroupTest):
_tenant_network_cidr = CONF.network.project_network_cidr _project_network_cidr = CONF.network.project_network_cidr
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):

View File

@ -53,9 +53,9 @@ class TestMultiHVNetworkOps(manager.NetworkScenarioTest):
@classmethod @classmethod
def skip_checks(cls): def skip_checks(cls):
super(TestMultiHVNetworkOps, cls).skip_checks() super(TestMultiHVNetworkOps, cls).skip_checks()
if not (CONF.network.tenant_networks_reachable if not (CONF.network.project_networks_reachable
or CONF.network.public_network_id): or CONF.network.public_network_id):
msg = ('Either tenant_networks_reachable must be "true", or ' msg = ('Either project_networks_reachable must be "true", or '
'public_network_id must be defined.') 'public_network_id must be defined.')
raise cls.skipException(msg) raise cls.skipException(msg)
for ext in ['router', 'security-group']: for ext in ['router', 'security-group']: