The ironic.dhcp.neutron Module

class ironic.dhcp.neutron.NeutronDHCPApi[source]

Bases: ironic.dhcp.base.BaseDHCP

API for communicating to neutron 2.x API.

create_cleaning_ports(task)[source]

Create neutron ports for each port on task.node to boot the ramdisk.

Parameters:task – a TaskManager instance.
Raises:NetworkError, InvalidParameterValue
Returns:a dictionary in the form {port.uuid: neutron_port[‘id’]}
delete_cleaning_ports(task)[source]

Deletes the neutron port created for booting the ramdisk.

Parameters:task – a TaskManager instance.
Raises:NetworkError, InvalidParameterValue
get_ip_addresses(task)[source]

Get IP addresses for all ports/portgroups in task.

Parameters:task – a TaskManager instance.
Returns:List of IP addresses associated with task’s ports/portgroups.
update_dhcp_opts(task, options, vifs=None)[source]

Send or update the DHCP BOOT options for this node.

Parameters:
  • task – A TaskManager instance.
  • options

    this will be a list of dicts, e.g.

    [{'opt_name': 'bootfile-name',
      'opt_value': 'pxelinux.0'},
     {'opt_name': 'server-ip-address',
      'opt_value': '123.123.123.456'},
     {'opt_name': 'tftp-server',
      'opt_value': '123.123.123.123'}]
    
  • vifs

    a dict of Neutron port/portgroup dicts to update DHCP options on. The port/portgroup dict key should be Ironic port UUIDs, and the values should be Neutron port UUIDs, e.g.

    {'ports': {'port.uuid': vif.id},
     'portgroups': {'portgroup.uuid': vif.id}}
    If the value is None, will get the list of
    ports/portgroups from the Ironic port/portgroup
    objects.
    
update_port_address(port_id, address, token=None)[source]

Update a port’s mac address.

Parameters:
  • port_id – Neutron port id.
  • address – new MAC address.
  • token – optional auth token.
Raises:

FailedToUpdateMacOnPort

update_port_dhcp_opts(port_id, dhcp_options, token=None)[source]

Update a port’s attributes.

Update one or more DHCP options on the specified port. For the relevant API spec, see http://docs.openstack.org/api/openstack-network/2.0/content/extra-dhc-opt-ext-update.html

Parameters:
  • port_id – designate which port these attributes will be applied to.
  • dhcp_options

    this will be a list of dicts, e.g.

    [{'opt_name': 'bootfile-name',
      'opt_value': 'pxelinux.0'},
     {'opt_name': 'server-ip-address',
      'opt_value': '123.123.123.456'},
     {'opt_name': 'tftp-server',
      'opt_value': '123.123.123.123'}]
    
  • token – optional auth token.
Raises:

FailedToUpdateDHCPOptOnPort

Project Source

This Page