networking_baremetal.plugins.ml2 package

Submodules

networking_baremetal.plugins.ml2.baremetal_mech module

class networking_baremetal.plugins.ml2.baremetal_mech.BaremetalMechanismDriver

Bases: SimpleAgentMechanismDriverBase

property connectivity

Return the mechanism driver connectivity type

The possible values are “l2”, “l3” and “legacy” (default).

Returns:

a string in (“l2”, “l3”, “legacy”)

create_network_postcommit(context)

Create a network.

Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource.

Parameters:

context – NetworkContext instance describing the new network.

create_network_precommit(context)

Allocate resources for a new network.

Create a new network, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction.

Parameters:

context – NetworkContext instance describing the new network.

create_port_postcommit(context)

Create a port.

Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will result in the deletion of the resource.

Parameters:

context – PortContext instance describing the port.

create_port_precommit(context)

Allocate resources for a new port.

Create a new port, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction.

Parameters:

context – PortContext instance describing the port.

create_subnet_postcommit(context)

Create a subnet.

Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource.

Parameters:

context – SubnetContext instance describing the new subnet.

create_subnet_precommit(context)

Allocate resources for a new subnet.

Create a new subnet, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction.

Parameters:

context – SubnetContext instance describing the new subnet.

delete_network_postcommit(context)

Delete a network.

Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted.

Parameters:

context – NetworkContext instance describing the current state of the network, prior to the call to delete it.

delete_network_precommit(context)

Delete resources for a network.

Delete network resources previously allocated by this mechanism driver for a network. Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction.

Parameters:

context – NetworkContext instance describing the current state of the network, prior to the call to delete it.

delete_port_postcommit(context)

Delete a port.

state of the port, prior to the call to delete it. Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted.

Parameters:

context – PortContext instance describing the current state of the port, prior to the call to delete it.

delete_port_precommit(context)

Delete resources of a port.

Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction.

Parameters:

context – PortContext instance describing the current state of the port, prior to the call to delete it.

delete_subnet_postcommit(context)

Delete a subnet.a

Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted.

Parameters:

context – SubnetContext instance describing the current state of the subnet, prior to the call to delete it.

delete_subnet_precommit(context)

Delete resources for a subnet.

Delete subnet resources previously allocated by this mechanism driver for a subnet. Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction.

Parameters:

context – SubnetContext instance describing the current state of the subnet, prior to the call to delete it.

get_allowed_network_types(agent)

Return the agent’s or driver’s allowed network types.

For example: return (‘flat’, …). You can also refer to the configuration the given agent exposes.

get_mappings(agent)

Return the agent’s bridge or interface mappings.

For example: agent[‘configurations’].get(‘bridge_mappings’, {}).

try_to_bind_segment_for_agent(context, segment, agent)

Try to bind with segment for agent.

Parameters:
  • context – PortContext instance describing the port

  • segment – segment dictionary describing segment to bind

  • agent – agents_db entry describing agent to bind

Returns:

True iff segment has been bound for agent

Neutron segments api-ref:

https://docs.openstack.org/api-ref/network/v2/#segments

Example segment dictionary: {‘segmentation_id’: ‘segmentation_id’,

‘network_type’: ‘network_type’, ‘id’: ‘segment_uuid’}

Called outside any transaction during bind_port() so that derived MechanismDrivers can use agent_db data along with built-in knowledge of the corresponding agent’s capabilities to attempt to bind to the specified network segment for the agent.

If the segment can be bound for the agent, this function must call context.set_binding() with appropriate values and then return True. Otherwise, it must return False.

update_network_postcommit(context)

Update a network.

Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource. update_network_postcommit is called for all changes to the network state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.

Parameters:

context – NetworkContext instance describing the new state of the network, as well as the original state prior to the update_network call.

update_network_precommit(context)

Update resources of a network.

Update values of a network, updating the associated resources in the database. Called inside transaction context on session. Raising an exception will result in rollback of the transaction. update_network_precommit is called for all changes to the network state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.

Parameters:

context – NetworkContext instance describing the new state of the network, as well as the original state prior to the update_network call.

update_port_postcommit(context)

Update a port.

Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will result in the deletion of the resource. update_port_postcommit is called for all changes to the port state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.

Parameters:

context – PortContext instance describing the new state of the port, as well as the original state prior to the update_port call.

update_port_precommit(context)

Update resources of a port.

Called inside transaction context on session to complete a port update as defined by this mechanism driver. Raising an exception will result in rollback of the transaction. update_port_precommit is called for all changes to the port state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.

Parameters:

context – PortContext instance describing the new state of the port, as well as the original state prior to the update_port call.

update_subnet_postcommit(context)

Update a subnet.

Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource. update_subnet_postcommit is called for all changes to the subnet state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.

Parameters:

context – SubnetContext instance describing the new state of the subnet, as well as the original state prior to the update_subnet call.

update_subnet_precommit(context)

Update resources of a subnet.

Update values of a subnet, updating the associated resources in the database. Called inside transaction context on session. Raising an exception will result in rollback of the transaction. update_subnet_precommit is called for all changes to the subnet state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.

Parameters:

context – SubnetContext instance describing the new state of the subnet, as well as the original state prior to the update_subnet call.

Module contents