ironic.drivers.modules.switch.generic_switch module

class ironic.drivers.modules.switch.generic_switch.GenericSwitchDriver(*args, **kwargs)[source]

Bases: SwitchDriverBase

Generic Switch Standalone Driver implementation.

This driver provides a switch driver implementation that is decoupled from the Neutron ML2 interface. It provides the same access to the underlying generic switch device interface but with a non-Neutron specific API interface. It is intended to be used as a driver within Ironic’s Standalone Networking Service.

DRIVER_NAME = 'generic-switch'
DRIVER_VERSION = '1.0'
SUPPORTED = True
delete_lag(switch_ids, lag_name)[source]

Delete LAG configuration from switches.

Parameters:
  • switch_ids – List of switch identifiers.

  • lag_name – Name of the LAG to delete.

Raises:

ValueError on parameter validation errors.

Raises:

SwitchNotFound if the specified switch does not exist.

Raises:

SwitchDriverException on configuration failures.

get_switch_ids()[source]

Get a list of all switch IDs.

Returns:

List of switch IDs

get_switch_info(switch_id)[source]

Get information about a switch.

Parameters:

switch_id – MAC address or hostname of the switch

Returns:

Dictionary containing switch information

Raises:

SwitchNotFound if switch is not found

classmethod get_translator()[source]

Return the translator for this driver’s config entries.

is_switch_configured(switch_id)[source]

Check if this driver is configured to manage the specified switch.

This method should return True if this driver is configured to handle the specified switch. This is used by the driver selection logic to determine which driver should handle a specific switch.

Parameters:

switch_id – Identifier for the switch to check.

Returns:

True if this driver can manage the specified switch, False otherwise.

reset_port(switch_id, port_name, native_vlan=None, allowed_vlans=None, default_vlan=None)[source]

Reset a port configuration on a switch.

Parameters:
  • switch_id – Identifier for the switch.

  • port_name – Name of the port on the switch.

  • native_vlan – VLAN ID to be removed from the port.

  • allowed_vlans – List of allowed VLAN IDs to be removed(optional).

  • default_vlan – VLAN ID to restore onto the port(optional).

Raises:

ValueError on parameter validation errors.

Raises:

SwitchNotFound if the specified switch does not exist.

Raises:

SwitchDriverException on configuration failures.

update_lag(switch_ids, lag_name, description, mode, native_vlan, aggregation_mode, allowed_vlans=None, default_vlan=None)[source]

Update LAG configuration across switches.

Parameters:
  • switch_ids – List of switch identifiers.

  • lag_name – Name of the LAG.

  • description – Description for the LAG.

  • mode – switchport mode (‘access’ or ‘trunk’).

  • native_vlan – VLAN ID to be set for the LAG.

  • aggregation_mode – Aggregation mode (e.g., ‘lacp’, ‘static’).

  • allowed_vlans – List of allowed VLAN IDs to be added (optional).

  • default_vlan – VLAN ID to removed from the port(optional).

Raises:

ValueError on parameter validation errors.

Raises:

SwitchNotFound if the specified switch does not exist.

Raises:

SwitchDriverException on configuration failures.

update_port(switch_id, port_name, description, mode, native_vlan, allowed_vlans=None, default_vlan=None, lag_name=None, **kwargs)[source]

Update a port configuration on a switch.

Parameters:
  • switch_id – Identifier for the switch.

  • port_name – Name of the port on the switch.

  • description – Description to set for the port.

  • mode – Port mode (‘access’, ‘trunk’, or ‘hybrid’).

  • native_vlan – VLAN ID to be set on the port.

  • allowed_vlans – List of allowed VLAN IDs to be added(optional).

  • default_vlan – VLAN ID to removed from the port(optional).

  • lag_name – LAG name if port is part of a LAG.

Raises:

ValueError on parameter validation errors.

Raises:

SwitchNotFound if the specified switch does not exist.

Raises:

SwitchDriverException on configuration failures.

class ironic.drivers.modules.switch.generic_switch.GenericSwitchTranslator[source]

Bases: BaseTranslator

Translates generic config to networking-generic-switch format.