API extensions provide a standardized way of introducing new API functionality.
While the neutron-lib
project itself does not serve an API, the neutron
project does and leverages the API extension framework from neutron-lib
.
API extensions consist of the following high-level constructs:
neutron_lib.api.definitions
package.rst
format and is used to generate the
openstack API reference. The API reference lives under the api-ref/source/v2
directory of the neutron-lib
project repository.neutron
or other sub-project that supports extensions. This concrete
class provides the extension’s metadata to the API server. These extension
classes reside outside of neutron-lib
, but leverage the base classes
from neutron_lib.api.extensions
. For more details see the section below
on using neutron-lib’s extension classes.neutron-lib
. For more details see the neutron api
extension dev-ref.The neutron_lib.api.extensions
module provides a set of base extension
descriptor classes consumers can use to define their extension descriptor(s).
For those extensions that have an API definition in
neutron_lib.api.definitions
, the APIExtensionDescriptor
class can
be used. For example:
from neutron_lib.api.definitions import provider_net
from neutron_lib.api import extensions
class Providernet(extensions.APIExtensionDescriptor):
api_definition = provider_net
# nothing else needed if default behavior is acceptable
For extensions that do not yet have a definition in
neutron_lib.api.definitions
, they can continue to use the
ExtensionDescriptor
as has been done historically.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.