ironic.common.network module¶
- class ironic.common.network.NetType(*values)[source]¶
Bases:
Enum- CLEANING = 'cleaning'¶
- INSPECTION = 'inspection'¶
- PROVISIONING = 'provisioning'¶
- RESCUING = 'rescuing'¶
- SERVICING = 'servicing'¶
- TENANT = 'tenant'¶
- property vif_key¶
- ironic.common.network.forget_vif(ironic_port, net_type, vif_id)[source]¶
Remove the record of a VIF attached to a baremetal port.
- Parameters:
ironic_port – the baremetal Port object to remove the VIF from.
net_type – the NetType whose
vif_keythe VIF is recorded under.vif_id – ID of the VIF. The record is only removed if it is the one recorded for
net_type.
- Returns:
True if the record matched and was removed, False otherwise.
- ironic.common.network.get_network_type_for_state(provision_state)[source]¶
Determine which network type should be active based on provision state.
- Parameters:
provision_state – The node’s current provision state.
- Returns:
String indicating the network type, or IDLE_NETWORK if the state doesn’t map to a specific network.
- 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.record_vif(ironic_port, net_type, vif_id)[source]¶
Record a VIF that is attached to a baremetal port.
- Parameters:
ironic_port – the baremetal Port object to record the VIF on.
net_type – the NetType the VIF was attached for; its
vif_keyis theinternal_infokey the ID is recorded under.vif_id – ID of the VIF.