neutron_lib package

neutron_lib package

Subpackages

Submodules

neutron_lib.constants module

class neutron_lib.constants.Sentinel

Bases: object

A constant object that does not change even when copied.

neutron_lib.context module

Context: context for security/db session.

class neutron_lib.context.Context(*args, **kwargs)

Bases: neutron_lib.context.ContextBaseWithSession

clear_transaction_constraint()
get_transaction_constraint()
session
set_transaction_constraint(resource, resource_id, rev_number)

Set a revision constraint to enforce before resource_id is changed.

Parameters:
  • resource – Collection name of resource (e.g. ports or networks)
  • resource_id – The primary key ID of the individual resource that should have its revision number matched before allowing the transaction to proceed.
  • rev_number – The revision_number that the resource should be at.
class neutron_lib.context.ContextBase(user_id=None, tenant_id=None, is_admin=None, timestamp=None, tenant_name=None, user_name=None, is_advsvc=None, **kwargs)

Bases: oslo_context.context.RequestContext

Security context and request information.

Represents the user taking a given action within the system.

elevated()

Return a version of this context with admin flag set.

classmethod from_dict(values)
tenant_id
tenant_name
to_dict()
to_policy_values()
class neutron_lib.context.ContextBaseWithSession(user_id=None, tenant_id=None, is_admin=None, timestamp=None, tenant_name=None, user_name=None, is_advsvc=None, **kwargs)

Bases: neutron_lib.context.ContextBase

connection
session
transaction
transaction_ctx
neutron_lib.context.get_admin_context()
neutron_lib.context.get_admin_context_without_session()

neutron_lib.fixture module

class neutron_lib.fixture.APIDefinitionFixture(*api_definitions)

Bases: fixtures.fixture.Fixture

Test fixture for testing neutron-lib API definitions.

Extension API definition RESOURCE_ATTRIBUTE_MAP dicts get updated as part of standard extension processing/handling. While this behavior is fine for service runtime, it can impact testing scenarios whereby test1 updates the attribute map (globally) and test2 doesn’t expect the test1 updates.

This fixture saves and restores 1 or more neutron-lib API definitions attribute maps. It should be used anywhere multiple tests can be run that might update an extension attribute map.

In addition the fixture backs up and restores the global attribute RESOURCES base on the boolean value of its backup_global_resources attribute.

classmethod all_api_definitions_fixture()

Return a fixture that handles all neutron-lib api-defs.

class neutron_lib.fixture.CallbackRegistryFixture(callback_manager=None)

Bases: fixtures.fixture.Fixture

Callback registry fixture.

This class is intended to be used as a fixture within unit tests and therefore consumers must register it using useFixture() within their unit test class. The implementation optionally allows consumers to pass in the CallbacksManager manager to use for your tests.

class neutron_lib.fixture.PlacementAPIClientFixture(placement_api_client)

Bases: fixtures.fixture.Fixture

Placement API client fixture.

This class is intended to be used as a fixture within unit tests and therefore consumers must register it using useFixture() within their unit test class.

class neutron_lib.fixture.PluginDirectoryFixture(plugin_directory=None)

Bases: fixtures.fixture.Fixture

class neutron_lib.fixture.SqlFixture

Bases: fixtures.fixture.Fixture

neutron_lib.version module

neutron_lib.worker module

class neutron_lib.worker.BaseWorker(worker_process_count=1)

Bases: oslo_service.service.ServiceBase

Partial implementation of the ServiceBase ABC.

Subclasses will still need to add the other abstract methods defined in service.ServiceBase. See oslo_service for more details.

If a plugin needs to handle synchronization with the Neutron database and do this only once instead of in every API worker, for instance, it would define a BaseWorker class and the plugin would have get_workers return an array of BaseWorker instances. For example:

class MyPlugin(...):
    def get_workers(self):
        return [MyPluginWorker()]

class MyPluginWorker(BaseWorker):
    def start(self):
        super(MyPluginWorker, self).start()
        do_sync()
start()

Start the worker.

If worker_process_count is greater than 0, a callback notification is sent. Subclasses should call this method before doing their own start() work. :returns: None

worker_process_count

The worker’s process count.

Returns:The number of processes to spawn for this worker.

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.