networking_generic_switch package¶
Subpackages¶
- networking_generic_switch.devices package
- Subpackages
- networking_generic_switch.devices.netmiko_devices package
- Submodules
- networking_generic_switch.devices.netmiko_devices.arista module
- networking_generic_switch.devices.netmiko_devices.aruba module
- networking_generic_switch.devices.netmiko_devices.brocade module
- networking_generic_switch.devices.netmiko_devices.cisco module
- networking_generic_switch.devices.netmiko_devices.cisco300 module
- networking_generic_switch.devices.netmiko_devices.cumulus module
- networking_generic_switch.devices.netmiko_devices.dell module
- networking_generic_switch.devices.netmiko_devices.hpe module
- networking_generic_switch.devices.netmiko_devices.huawei module
- networking_generic_switch.devices.netmiko_devices.huawei_vrpv8 module
- networking_generic_switch.devices.netmiko_devices.juniper module
- networking_generic_switch.devices.netmiko_devices.mellanox_mlnxos module
- networking_generic_switch.devices.netmiko_devices.nokia module
- networking_generic_switch.devices.netmiko_devices.ovs module
- networking_generic_switch.devices.netmiko_devices.pluribus module
- networking_generic_switch.devices.netmiko_devices.ruijie module
- networking_generic_switch.devices.netmiko_devices.sonic module
- Module contents
- networking_generic_switch.devices.netmiko_devices package
- Submodules
- networking_generic_switch.devices.utils module
- Module contents
- Subpackages
Submodules¶
networking_generic_switch.config module¶
- networking_generic_switch.config.get_devices()¶
Parse supplied config files and fetch defined supported devices.
networking_generic_switch.exceptions module¶
- exception networking_generic_switch.exceptions.GenericSwitchConfigException(**kwargs)¶
Bases:
NeutronException
- message = '%(option)s must be one of: %(allowed_options)s'¶
- exception networking_generic_switch.exceptions.GenericSwitchEntrypointLoadError(**kwargs)¶
Bases:
GenericSwitchException
- message = 'Failed to load entrypoint %(ep)s: %(err)s'¶
- exception networking_generic_switch.exceptions.GenericSwitchException(**kwargs)¶
Bases:
NeutronException
- message = '%(method)s failed.'¶
- exception networking_generic_switch.exceptions.GenericSwitchNetmikoConfigError(**kwargs)¶
Bases:
GenericSwitchException
- message = 'Netmiko configuration error: %(config)s, error: %(error)s'¶
- exception networking_generic_switch.exceptions.GenericSwitchNetmikoConnectError(**kwargs)¶
Bases:
GenericSwitchException
- message = 'Netmiko connection error: %(config)s, error: %(error)s'¶
- exception networking_generic_switch.exceptions.GenericSwitchNetmikoMethodError(**kwargs)¶
Bases:
GenericSwitchException
- message = 'Can not parse arguments: commands %(cmds)s, args %(args)s'¶
- exception networking_generic_switch.exceptions.GenericSwitchNetmikoNotSupported(**kwargs)¶
Bases:
GenericSwitchException
- message = 'Netmiko does not support device type %(device_type)s'¶
- exception networking_generic_switch.exceptions.GenericSwitchNetworkNameFormatInvalid(**kwargs)¶
Bases:
GenericSwitchException
- message = "Invalid value for 'ngs_network_name_format': %(name_format)s. Valid format options include 'network_id' and 'segmentation_id'"¶
networking_generic_switch.generic_switch_mech module¶
- class networking_generic_switch.generic_switch_mech.GenericSwitchDriver¶
Bases:
MechanismDriver
- bind_port(context)¶
Attempt to bind a port.
- Parameters:
context – PortContext instance describing the port
This method is called outside any transaction to attempt to establish a port binding using this mechanism driver. Bindings may be created at each of multiple levels of a hierarchical network, and are established from the top level downward. At each level, the mechanism driver determines whether it can bind to any of the network segments in the context.segments_to_bind property, based on the value of the context.host property, any relevant port or network attributes, and its own knowledge of the network topology. At the top level, context.segments_to_bind contains the static segments of the port’s network. At each lower level of binding, it contains static or dynamic segments supplied by the driver that bound at the level above. If the driver is able to complete the binding of the port to any segment in context.segments_to_bind, it must call context.set_binding with the binding details. If it can partially bind the port, it must call context.continue_binding with the network segments to be used to bind at the next lower level.
If the binding results are committed after bind_port returns, they will be seen by all mechanism drivers as update_port_precommit and update_port_postcommit calls. But if some other thread or process concurrently binds or updates the port, these binding results will not be committed, and update_port_precommit and update_port_postcommit will not be called on the mechanism drivers with these results. Because binding results can be discarded rather than committed, drivers should avoid making persistent state changes in bind_port, or else must ensure that such state changes are eventually cleaned up.
Implementing this method explicitly declares the mechanism driver as having the intention to bind ports. This is inspected by the QoS service to identify the available QoS rules you can use with ports.
- create_network_postcommit(context)¶
Create a network.
- Parameters:
context – NetworkContext instance describing the new 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.
- create_network_precommit(context)¶
Allocate resources for a new network.
- Parameters:
context – NetworkContext instance describing the 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.
- create_port_postcommit(context)¶
Create a port.
- Parameters:
context – PortContext instance describing the 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.
- create_port_precommit(context)¶
Allocate resources for a new port.
- Parameters:
context – PortContext instance describing the 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.
- create_subnet_postcommit(context)¶
Create a subnet.
- Parameters:
context – SubnetContext instance describing the new 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.
- create_subnet_precommit(context)¶
Allocate resources for a new subnet.
- Parameters:
context – SubnetContext instance describing the new subnet.
rt = context.current device_id = port[‘device_id’] device_owner = port[‘device_owner’] 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.
- delete_network_postcommit(context)¶
Delete a network.
- Parameters:
context – NetworkContext instance describing the current state of the network, prior to the call to delete it.
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.
- delete_network_precommit(context)¶
Delete resources for a network.
- Parameters:
context – NetworkContext instance describing the current state of the network, prior to the call to delete it.
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.
- delete_port_postcommit(context)¶
Delete a port.
- Parameters:
context – PortContext instance describing the current 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.
- delete_port_precommit(context)¶
Delete resources of a port.
- Parameters:
context – PortContext instance describing the current state of the port, prior to the call to delete it.
Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction.
- delete_subnet_postcommit(context)¶
Delete a subnet.
- Parameters:
context – SubnetContext instance describing the current state of the subnet, prior to the call to delete it.
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.
- delete_subnet_precommit(context)¶
Delete resources for a subnet.
- Parameters:
context – SubnetContext instance describing the current state of the subnet, prior to the call to delete it.
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.
- initialize()¶
Perform driver initialization.
Called after all drivers have been loaded and the database has been initialized. No abstract methods defined below will be called prior to this method being called.
- update_network_postcommit(context)¶
Update a network.
- Parameters:
context – NetworkContext instance describing the new state of the network, as well as the original state prior to the update_network call.
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.
- update_network_precommit(context)¶
Update resources of a network.
- Parameters:
context – NetworkContext instance describing the new state of the network, as well as the original state prior to the update_network call.
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.
- update_port_postcommit(context)¶
Update a port.
- Parameters:
context – PortContext instance describing the new state of the port, as well as the original state prior to the update_port call.
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.
- update_port_precommit(context)¶
Update resources of a port.
- Parameters:
context – PortContext instance describing the new state of the port, as well as the original state prior to the update_port call.
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.
- update_subnet_postcommit(context)¶
Update a subnet.
- Parameters:
context – SubnetContext instance describing the new state of the subnet, as well as the original state prior to the update_subnet call.
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.
- update_subnet_precommit(context)¶
Update resources of a subnet.
- Parameters:
context – SubnetContext instance describing the new state of the subnet, as well as the original state prior to the update_subnet call.
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.
networking_generic_switch.locking module¶
- class networking_generic_switch.locking.PoolLock(coordinator, locks_pool_size=1, locks_prefix='ngs-', timeout=0)¶
Bases:
object
Tooz lock wrapper for pools of locks
If tooz coordinator is provided, it will attempt to grab any lock from a predefined set of names, with configurable set size (lock pool), and keep attempting for until given timeout is reached.