ironic.networking.switch_config module¶
Utilities for switch configuration and VLAN management.
- ironic.networking.switch_config.get_switch_vlan_config(switch_driver, switch_id)[source]¶
Get VLAN configuration for a switch.
Retrieves switch-specific VLAN configuration from the driver, with fallback to global configuration options.
- Parameters:
switch_driver – The switch driver instance.
switch_id – Identifier of the switch.
- Returns:
Dictionary containing allowed_vlans
- Raises:
Any exceptions from switch_driver.get_switch_info()
- ironic.networking.switch_config.validate_vlan_allowed(vlan_id, allowed_vlans_config=None, switch_config=None)[source]¶
Validate that a VLAN ID is allowed.
- Parameters:
vlan_id – The VLAN ID to validate
allowed_vlans_config – Global list of allowed vlans from config
switch_config – Optional switch-specific configuration dict that may contain an ‘allowed_vlans’ key
- Returns:
True if the VLAN is allowed
- Raises:
InvalidParameterValue if the VLAN is not allowed
- ironic.networking.switch_config.validate_vlan_configuration(vlans_to_check, switch_driver, switch_id, operation_description='operation')[source]¶
Validate VLAN configuration against allowed lists.
Checks if the specified VLANs are allowed according to the switch-specific or global configuration.
- Parameters:
vlans_to_check – List of VLAN IDs to validate.
switch_driver – The switch driver instance.
switch_id – Identifier of the switch.
operation_description – Description of the operation for error messages.
- Raises:
InvalidParameterValue if any VLAN is not allowed.