ironic.common.network module

ironic.common.network.get_node_vif_ids(task)[source]

Get all VIF ids for a node.

This function does not handle multi node operations.

Parameters:

task – a TaskManager instance.

Returns:

A dict of Node’s neutron ports where keys are ‘ports’ & ‘portgroups’ and the values are dict of UUIDs and their associated VIFs, e.g.

{'ports': {'port.uuid': vif.id},
 'portgroups': {'portgroup.uuid': vif.id}}

ironic.common.network.get_physnets_by_portgroup_id(task, portgroup_id, exclude_port=None)[source]

Return the set of physical networks associated with a portgroup.

Parameters:
  • task – a TaskManager instance.

  • portgroup_id – ID of the portgroup.

  • exclude_port – A Port object to exclude from the determination of the portgroup’s physical network, or None.

Returns:

The set of physical networks associated with the portgroup. The set will contain zero or one physical networks.

Raises:

PortgroupPhysnetInconsistent if the portgroup’s ports are not assigned the same physical network.

ironic.common.network.get_physnets_for_node(task)[source]

Return the set of physical networks for a node.

Returns the set of physical networks associated with a node’s ports. The physical network None is excluded from the set.

Parameters:

task – a TaskManager instance

Returns:

A set of physical networks.

ironic.common.network.get_portgroup_by_id(task, portgroup_id)[source]

Lookup a portgroup by ID on a task object.

Parameters:
  • task – a TaskManager instance

  • portgroup_id – ID of the portgroup.

Returns:

A Portgroup object or None.

ironic.common.network.get_ports_by_portgroup_id(task, portgroup_id)[source]

Lookup ports by their portgroup ID on a task object.

Parameters:
  • task – a TaskManager instance

  • portgroup_id – ID of the portgroup.

Returns:

A list of Port objects.

ironic.common.network.remove_vifs_from_node(task)[source]

Remove all vif attachment records from a node.

Parameters:

task – a TaskManager instance.