Package ifaceinfo Documentation

Class IfaceInfoTools

None

__init__


def __init__(self)

hex2ip


def hex2ip(self, x_addr)

private methode convert hexadecimal representation to string decimal ip address return string (as ip address representation)

ip2hex


def ip2hex(self, addr)

private methode convert string decimal ip address to hexadecimal representation return string (as hex representation)

ip_address


def ip_address(self, ifacename)

private methode get ip address of interface using socket interface

network_address


def network_address(self, ipaddr, mask)

private methode used to calculate the network address

network_mask


def network_mask(self, ifacename)

private methode get net mask address of interface using socket interface

reverse_ip


def reverse_ip(self, ipaddress)

Private method that reverse ip address

Class InterfacesInfos

None

__init__


def __init__(self)

data initialisation maybe in the future somme other data will be loaded directly to improve performance and data usability at this time the scan of /sys/class/net are performed in the initialisation of the class

as_dict


def as_dict(self)

return interfaces informations as dict result

get_timestamp


def get_timestamp(self)

get timestamp of data collection

hex2ip


def hex2ip(self, x_addr)

private methode convert hexadecimal representation to string decimal ip address return string (as ip address representation)

iface_as_dict


def iface_as_dict(self, ifacename)

return interfaces informations as dict result

iface_by_ifindex


def iface_by_ifindex(self, ifindex, info='full')

get interface that have ifindex=X ifindex is located in /sys/class/net//ifindex return dict


def iface_by_iflink(self, iflink, info='full')

get interface that have iflink=X ifindex is located in /sys/class/net//iflink return dict

iface_by_uid


def iface_by_uid(self, identifier, value, info='full')

get interfaces by defined identifier and value, the third parametre info allow the choise to return the result as a full data or briefly

the identifier can be any key value of the class definition this funtion is used by self.getifaceByIndex() and self.getifaceByLink()

return dict

iface_info


def iface_info(self, ifaceName)

get specific interface name with full information return dict

iface_network_config


def iface_network_config(self, ifacename)

get specific interface network configuration only, return dict

iface_routes


def iface_routes(self, ifacename)

return the routing table of specific interface.

iface_statistics


def iface_statistics(self, ifacename)

return a dict of specific interface with statistics

iface_type


def iface_type(self, ifacename)

return a dict of specific interface with interface_type if the interface is not found return empty dict

ifaces_as_dict


def ifaces_as_dict(self)

return interfaces informations as dict result give the same result as self.as_dict()

ifaces_by_status


def ifaces_by_status(self, status, info='full')

get interface by status, this function is used by self.getifacesUp() and self.getifacesDown() return an array with dict

ifaces_count


def ifaces_count(self)

return a number of detected interfaces

ifaces_down


def ifaces_down(self, info='full')

get interface down and other status return an array with dict

ifaces_ifindex


def ifaces_ifindex(self)

get all interfaces name and ifindex return array of dict


def ifaces_ifindex_iflink(self)

get all interfaces with brief informations (name, ifindex, iflink, ip and mask) return an array of dict


def ifaces_iflink(self)

get all interfaces name and iflink return array of dict

ifaces_info


def ifaces_info(self)

get all interfaces informations (full collected information)

ifaces_list


def ifaces_list(self)

get a list of interface name return array of string

ifaces_network_config


def ifaces_network_config(self)

get the interfaces network configuration only

ifaces_routes


def ifaces_routes(self)

return the routing table as array.

ifaces_statistics


def ifaces_statistics(self)

return a list of all interfaces with statistics

ifaces_statistics_as_dict


def ifaces_statistics_as_dict(self)

return ifaces statistics as dict

ifaces_type


def ifaces_type(self)

return a list of all interfaces with uevent that give device type

ifaces_up


def ifaces_up(self, info='full')

get interface up only return an array with dict

ip2hex


def ip2hex(self, addr)

private methode convert string decimal ip address to hexadecimal representation return string (as hex representation)

ip_address


def ip_address(self, ifacename)

private methode get ip address of interface using socket interface

list_interfaces


def list_interfaces(self)

list all interafces as list()

network_address


def network_address(self, ipaddr, mask)

private methode used to calculate the network address

network_mask


def network_mask(self, ifacename)

private methode get net mask address of interface using socket interface

refresh


def refresh(self)

this function refresh the informations collected when the class is loaded if you want to work with fresh data use this function to reload the data updated

reload


def reload(self)

same as self.refresh()

reverse_ip


def reverse_ip(self, ipaddress)

Private method that reverse ip address