# Path: roscraco/exception.py
# class RouterParseError(RouterError):
#     pass


from ..exception import RouterParseError
    from socket import inet_aton
    from struct import unpack
    from socket import inet_ntoa
    from struct import pack
    from .validator import is_valid_mac_address

def ip2long(ip_addr):
    """Converts an IP address string to an integer."""
    ip_packed = inet_aton(ip_addr)
    ip = unpack('!L', ip_packed)[0]
    return ip


def long2ip(ip):
    """Converts an integer representation of an IP address to string."""
    return inet_ntoa(pack('!L', ip))


def normalize_mac(mac):
    """Converts any MAC address format to lowercase HEX with no separators."""
    mac = mac.lower()
    if not is_valid_mac_address(mac):

# Path: roscraco/exception.py
# class RouterParseError(RouterError):
#     pass


# Path: roscraco/helper/converter.py
from ..exception import RouterParseError
    from socket import inet_aton
    from struct import unpack
    from socket import inet_ntoa
    from struct import pack
    from .validator import is_valid_mac_address


def ip2long(ip_addr):
    """Converts an IP address string to an integer."""
    ip_packed = inet_aton(ip_addr)
    ip = unpack('!L', ip_packed)[0]
    return ip


def long2ip(ip):
    """Converts an integer representation of an IP address to string."""
    return inet_ntoa(pack('!L', ip))


def normalize_mac(mac):
    """Converts any MAC address format to lowercase HEX with no separators."""
    mac = mac.lower()
    if not is_valid_mac_address(mac):

        raise RouterParseError('MAC address %s is invalid!' % mac)