functest.core.tenantnetwork module

Ease deploying tenant networks

It offers a simple way to create all tenant network resources required by a testcase (including all Functest ones):

  • TenantNetwork1 selects the user and the project set as env vars
  • TenantNetwork2 creates a user and project to isolate the same resources

This classes could be reused by more complexed scenarios (Single VM)

class functest.core.tenantnetwork.NewProject(cloud, case_name, guid)

Bases: object

Ease creating new projects/users

clean()

Remove projects/users

create()

Create projects/users

get_environ()

Get new environ

class functest.core.tenantnetwork.TenantNetwork1(**kwargs)

Bases: xtesting.core.testcase.TestCase

Create a tenant network (scenario1)

It creates and configures all tenant network resources required by advanced testcases (subnet, network and router).

It ensures that all testcases inheriting from TenantNetwork1 could work without network specific configurations (or at least read the same config data).

cidr = '192.168.120.0/24'
clean()

Clean the resources.

It can be overriden if resources must be deleted after running the test case.

create_network_resources()

Create all tenant network resources

It creates a router which gateway is the external network detected. The new subnet is attached to that router.

Raises: expection on error

static get_default_role(cloud, member='Member')

Get the default role

It also tests the role in lowercase to avoid possible conflicts.

static get_external_network(cloud)

Return the configured external network name or the first retrieved external network name

static get_public_auth_url(cloud)

Get Keystone public endpoint

run(**kwargs)

Run the test case.

It allows running TestCase and getting its execution status.

The subclasses must override the default implementation which is false on purpose.

The new implementation must set the following attributes to push the results to DB:

  • result,
  • start_time,
  • stop_time.
Args:
kwargs: Arbitrary keyword arguments.
shared_network = False
class functest.core.tenantnetwork.TenantNetwork2(**kwargs)

Bases: functest.core.tenantnetwork.TenantNetwork1

Create a tenant network (scenario2)

It creates new user/project before creating and configuring all tenant network resources required by a testcase (subnet, network and router).

It ensures that all testcases inheriting from TenantNetwork2 could work without network specific configurations (or at least read the same config data).

clean()

Clean the resources.

It can be overriden if resources must be deleted after running the test case.