def macaddr_from_ipv4(ipv4): """ Given @ipv4, returns the @macaddr or None if unknown / lookup failed, etc. """ if not is_ipv4_address_valid(ipv4): return None ipv4 = normalize_ipv4_address(ipv4) by_ipv4 = load(DHCPD_LEASES_FILENAME)[0] if ipv4 not in by_ipv4: return None else: return by_ipv4[ipv4].macaddr
def __init__(self, ipv4): self.ipv4 = normalize_ipv4_address(ipv4)