Neutron Plugin Architecture
Salvatore Orlando: How to write a Neutron Plugin (if you really need to)
Plugin API
v2 Neutron Plug-in API specification.
NeutronPluginBaseV2 provides the definition of minimum set of
methods that needs to be implemented by a v2 Neutron Plug-in.
-
class neutron.neutron_plugin_base_v2.NeutronPluginBaseV2
-
create_network(context, network)
Create a network.
Create a network, which represents an L2 network segment which
can have a set of subnets and ports associated with it.
Parameters: |
- context – neutron api request context
- network – dictionary describing the network, with keys
as listed in the RESOURCE_ATTRIBUTE_MAP object
in neutron/api/v2/attributes.py. All keys will
be populated.
|
-
create_port(context, port)
Create a port.
Create a port, which is a connection point of a device (e.g., a VM
NIC) to attach to a L2 neutron network.
Parameters: |
- context – neutron api request context
- port – dictionary describing the port, with keys as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. All keys will be
populated.
|
-
create_subnet(context, subnet)
Create a subnet.
Create a subnet, which represents a range of IP addresses
that can be allocated to devices
Parameters: |
- context – neutron api request context
- subnet – dictionary describing the subnet, with keys
as listed in the RESOURCE_ATTRIBUTE_MAP object
in neutron/api/v2/attributes.py. All keys will
be populated.
|
-
create_subnetpool(context, subnetpool)
Create a subnet pool.
Parameters: |
- context – neutron api request context
- subnetpool – Dictionary representing the subnetpool to create.
|
-
delete_network(context, id)
Delete a network.
Parameters: |
- context – neutron api request context
- id – UUID representing the network to delete.
|
-
delete_port(context, id)
Delete a port.
Parameters: |
- context – neutron api request context
- id – UUID representing the port to delete.
|
-
delete_subnet(context, id)
Delete a subnet.
Parameters: |
- context – neutron api request context
- id – UUID representing the subnet to delete.
|
-
delete_subnetpool(context, id)
Delete a subnet pool.
Parameters: |
- context – neutron api request context
- id – The UUID of the subnet pool to delete.
|
-
get_network(context, id, fields=None)
Retrieve a network.
Parameters: |
- context – neutron api request context
- id – UUID representing the network to fetch.
- fields – a list of strings that are valid keys in a
network dictionary as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Only these fields
will be returned.
|
-
get_networks(context, filters=None, fields=None, sorts=None, limit=None, marker=None, page_reverse=False)
Retrieve a list of networks.
The contents of the list depends on
the identity of the user making the request (as indicated by the
context) as well as any filters.
Parameters: |
- context – neutron api request context
- filters – a dictionary with keys that are valid keys for
a network as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Values in this
dictionary are an iterable containing values that will
be used for an exact match comparison for that value.
Each result returned by this function will have matched
one of the values for each key in filters.
- fields – a list of strings that are valid keys in a
network dictionary as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Only these fields
will be returned.
|
-
get_networks_count(context, filters=None)
Return the number of networks.
The result depends on the identity
of the user making the request (as indicated by the context) as well
as any filters.
Parameters: |
- context – neutron api request context
- filters – a dictionary with keys that are valid keys for
a network as listed in the
RESOURCE_ATTRIBUTE_MAP object
in neutron/api/v2/attributes.py. Values in
this dictionary are an iterable containing values that
will be used for an exact match comparison for that
value. Each result returned by this function will have
matched one of the values for each key in filters.
|
- NOTE: this method is optional, as it was not part of the originally
- defined plugin API.
-
get_port(context, id, fields=None)
Retrieve a port.
Parameters: |
- context – neutron api request context
- id – UUID representing the port to fetch.
- fields – a list of strings that are valid keys in a port
dictionary as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Only these fields
will be returned.
|
-
get_ports(context, filters=None, fields=None, sorts=None, limit=None, marker=None, page_reverse=False)
Retrieve a list of ports.
The contents of the list depends on the identity of the user making
the request (as indicated by the context) as well as any filters.
Parameters: |
- context – neutron api request context
- filters – a dictionary with keys that are valid keys for
a port as listed in the RESOURCE_ATTRIBUTE_MAP
object in neutron/api/v2/attributes.py. Values
in this dictionary are an iterable containing values
that will be used for an exact match comparison for
that value. Each result returned by this function will
have matched one of the values for each key in filters.
- fields – a list of strings that are valid keys in a
port dictionary as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Only these fields
will be returned.
|
-
get_ports_count(context, filters=None)
Return the number of ports.
The result depends on the identity of the user making the request
(as indicated by the context) as well as any filters.
Parameters: |
- context – neutron api request context
- filters – a dictionary with keys that are valid keys for
a network as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Values in this
dictionary are an iterable containing values that will
be used for an exact match comparison for that value.
Each result returned by this function will have matched
one of the values for each key in filters.
|
Note
this method is optional, as it was not part of the originally
defined plugin API.
-
get_subnet(context, id, fields=None)
Retrieve a subnet.
Parameters: |
- context – neutron api request context
- id – UUID representing the subnet to fetch.
- fields – a list of strings that are valid keys in a
subnet dictionary as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Only these fields
will be returned.
|
-
get_subnetpool(context, id, fields=None)
Show a subnet pool.
Parameters: |
- context – neutron api request context
- id – The UUID of the subnetpool to show.
|
-
get_subnetpools(context, filters=None, fields=None, sorts=None, limit=None, marker=None, page_reverse=False)
Retrieve list of subnet pools.
-
get_subnets(context, filters=None, fields=None, sorts=None, limit=None, marker=None, page_reverse=False)
Retrieve a list of subnets.
The contents of the list depends on
the identity of the user making the request (as indicated by the
context) as well as any filters.
Parameters: |
- context – neutron api request context
- filters – a dictionary with keys that are valid keys for
a subnet as listed in the RESOURCE_ATTRIBUTE_MAP
object in neutron/api/v2/attributes.py.
Values in this dictionary are an iterable containing
values that will be used for an exact match comparison
for that value. Each result returned by this
function will have matched one of the values for each
key in filters.
- fields – a list of strings that are valid keys in a
subnet dictionary as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Only these fields
will be returned.
|
-
get_subnets_count(context, filters=None)
Return the number of subnets.
The result depends on the identity of
the user making the request (as indicated by the context) as well as
any filters.
Parameters: |
- context – neutron api request context
- filters – a dictionary with keys that are valid keys for
a network as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py. Values in this
dictionary are an iterable containing values that
will be used for an exact match comparison for that
value. Each result returned by this function will
have matched one of the values for each key in filters.
|
Note
this method is optional, as it was not part of the originally
defined plugin API.
-
get_workers()
Returns a collection NeutronWorker instances
If a plugin needs to define worker processes outside of API/RPC workers
then it will override this and return a collection of NeutronWorker
instances
-
rpc_state_report_workers_supported()
Return whether the plugin supports state report RPC workers.
Note
this method is optional, as it was not part of the originally
defined plugin API.
-
rpc_workers_supported()
Return whether the plugin supports multiple RPC workers.
A plugin that supports multiple RPC workers should override the
start_rpc_listeners method to ensure that this method returns True and
that start_rpc_listeners is called at the appropriate time.
Alternately, a plugin can override this method to customize detection
of support for multiple rpc workers
Note
this method is optional, as it was not part of the originally
defined plugin API.
-
start_rpc_listeners()
Start the RPC listeners.
Most plugins start RPC listeners implicitly on initialization. In
order to support multiple process RPC, the plugin needs to expose
control over when this is started.
Note
this method is optional, as it was not part of the originally
defined plugin API.
-
start_rpc_state_reports_listener()
Start the RPC listeners consuming state reports queue.
This optional method creates rpc consumer for REPORTS queue only.
Note
this method is optional, as it was not part of the originally
defined plugin API.
-
update_network(context, id, network)
Update values of a network.
Parameters: |
- context – neutron api request context
- id – UUID representing the network to update.
- network – dictionary with keys indicating fields to update.
valid keys are those that have a value of True for
‘allow_put’ as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py.
|
-
update_port(context, id, port)
Update values of a port.
Parameters: |
- context – neutron api request context
- id – UUID representing the port to update.
- port – dictionary with keys indicating fields to update.
valid keys are those that have a value of True for
‘allow_put’ as listed in the RESOURCE_ATTRIBUTE_MAP
object in neutron/api/v2/attributes.py.
|
-
update_subnet(context, id, subnet)
Update values of a subnet.
Parameters: |
- context – neutron api request context
- id – UUID representing the subnet to update.
- subnet – dictionary with keys indicating fields to update.
valid keys are those that have a value of True for
‘allow_put’ as listed in the
RESOURCE_ATTRIBUTE_MAP object in
neutron/api/v2/attributes.py.
|
-
update_subnetpool(context, id, subnetpool)
Update a subnet pool.
Parameters: |
- context – neutron api request context
- subnetpool – Dictionary representing the subnetpool attributes
to update.
|