ironic_python_agent.netutils module

class ironic_python_agent.netutils.RawPromiscuousSockets(interface_names, protocol)[source]

Bases: object

ironic_python_agent.netutils.bring_up_vlan_interfaces(interfaces_list)[source]

Bring up vlan interfaces based on kernel params

Use the configured value of enable_vlan_interfaces to determine if VLAN interfaces should be brought up using ip commands. If enable_vlan_interfaces defines a particular vlan then bring up that vlan. If it defines an interface or all then use LLDP info to figure out which VLANs should be brought up.

Parameters:

interfaces_list – List of current interfaces

Returns:

List of vlan interface names that have been added

ironic_python_agent.netutils.get_default_ip_addr(family, interface_id)[source]

Retrieve default IPv4, IPv6 or mac address.

ironic_python_agent.netutils.get_hostname()[source]
ironic_python_agent.netutils.get_ipv4_addr(interface_id)[source]
ironic_python_agent.netutils.get_ipv6_addr(interface_id)[source]
ironic_python_agent.netutils.get_lldp_info(interface_names)[source]

Get LLDP info from the switch(es) the agent is connected to.

Listens on either a single or all interfaces for LLDP packets, then parses them. If no LLDP packets are received before lldp_timeout, returns a dictionary in the form {‘interface’: [],…}.

Parameters:

interface_names – The interface to listen for packets on. If None, will listen on each interface.

Returns:

A dictionary in the form {‘interface’: [(lldp_type, lldp_data)],…}

ironic_python_agent.netutils.get_mac_addr(interface_id)[source]
ironic_python_agent.netutils.get_wildcard_address()[source]
class ironic_python_agent.netutils.ifreq[source]

Bases: Structure

Class for setting flags on a socket.

ifr_flags

Structure/Union member

ifr_ifrn

Structure/Union member

ironic_python_agent.netutils.interface_has_carrier(interface_name)[source]
ironic_python_agent.netutils.is_bond(interface_name)[source]
ironic_python_agent.netutils.is_network_device(interface_name)[source]
ironic_python_agent.netutils.is_vlan(interface_name)[source]
ironic_python_agent.netutils.list_interfaces()[source]
ironic_python_agent.netutils.wrap_ipv6(ip)[source]