The neutron_taas.tests.tempest_plugin.tests.api.test_taas Module

class neutron_taas.tests.tempest_plugin.tests.api.test_taas.TaaSExtensionTestJSON(*args, **kwargs)

Bases: neutron_taas.tests.tempest_plugin.tests.api.base.BaseTaaSTest

classmethod resource_setup()

Class level resource setup for test cases.

resource_setup is invoked once all credentials (and related network resources have been provisioned and after client aliases - if any - have been defined.

The use case for resource_setup is test optimization: provisioning of project-specific “expensive” resources that are not dirtied by tests and can thus safely be re-used by multiple tests.

System wide resources shared by all tests could instead be provisioned only once, before the test run.

Resources provisioned here must be cleaned up during resource_cleanup. This is best achieved by scheduling a cleanup via addClassResourceCleanup.

Some test resources have an asynchronous delete process. It’s best practice for them to schedule a wait for delete via addClassResourceCleanup to avoid having resources in process of deletion when we reach the credentials cleanup step.

Example:

@classmethod
def resource_setup(cls):
    super(MyTest, cls).resource_setup()
    servers = cls.os_primary.compute.ServersClient()
    # Schedule delete and wait so that we can first delete the
    # two servers and then wait for both to delete
    # Create server 1
    cls.shared_server = servers.create_server()
    # Create server 2. If something goes wrong we schedule cleanup
    # of server 1 anyways.
    try:
        cls.shared_server2 = servers.create_server()
        # Wait server 2
        cls.addClassResourceCleanup(
            waiters.wait_for_server_termination,
            servers, cls.shared_server2['id'],
            ignore_error=False)
    finally:
        # Wait server 1
        cls.addClassResourceCleanup(
            waiters.wait_for_server_termination,
            servers, cls.shared_server['id'],
            ignore_error=False)
            # Delete server 1
        cls.addClassResourceCleanup(
            test_utils.call_and_ignore_notfound_exc,
            servers.delete_server,
            cls.shared_server['id'])
        # Delete server 2 (if it was created)
        if hasattr(cls, 'shared_server2'):
            cls.addClassResourceCleanup(
                test_utils.call_and_ignore_notfound_exc,
                servers.delete_server,
                cls.shared_server2['id'])
classmethod skip_checks(**func_kwargs)

Class level skip checks.

Subclasses verify in here all conditions that might prevent the execution of the entire test class. Skipping here prevents any other class fixture from being executed i.e. no credentials or other resource allocation will happen.

Tests defined in the test class will no longer appear in test results. The setUpClass for the entire test class will be marked as SKIPPED instead.

At this stage no test credentials are available, so skip checks should rely on configuration alone. This is deliberate since skips based on the result of an API call are discouraged.

The following checks are implemented in test.py already:

  • check that alt credentials are available when requested by the test
  • check that admin credentials are available when requested by the test
  • check that the identity version specified by the test is marked as enabled in the configuration

Overriders of skip_checks must always invoke skip_check on super first.

Example:

@classmethod
def skip_checks(cls):
    super(Example, cls).skip_checks()
    if not CONF.service_available.my_service:
        skip_msg = ("%s skipped as my_service is not available")
        raise cls.skipException(skip_msg % cls.__name__)
test_create_and_update_tap_flow()

Test idempotent id: bb4d5482-37fc-46b5-85a5-5867e9adbfae create and update tap flow

Test update tap flow - update description.
test_create_and_update_tap_service()

Test idempotent id: 687089b8-b045-496d-86bf-030b380039d1 create and update tap service

Test update tap service - update description.
test_create_tap_service_and_flow()

Test idempotent id: b993c14e-797a-4c91-b4da-8cb1a450aa2f create tap service adn tap flow

Test create tap service and flow.
test_delete_tap_resources_after_tf_port_delete()

Test idempotent id: 9ba4edfd-4002-4c44-b02b-6c4f71b40a92 delete tap resources after tf port delete

Test delete tap service after deletion of tf port.
test_delete_tap_resources_after_ts_port_delete()

Test idempotent id: d7a2115d-16b4-41cf-95a6-dcebc3682b24 delete tap resources after ts port delete

Test delete tap resources after deletion of ts port.