Exemple #1
0
def ethertype_to_ip_version(ethertype):
    if ethertype == n_const.IPv4:
        return n_const.IP_VERSION_4
    if ethertype == n_const.IPv6:
        return n_const.IP_VERSION_6
    raise exceptions.InvalidEtherTypeException(ethertype=ethertype)
Exemple #2
0
def ip_version_to_ethertype(ip_version):
    if ip_version == n_const.IP_VERSION_4:
        return n_const.IPv4
    if ip_version == n_const.IP_VERSION_6:
        return n_const.IPv6
    raise exceptions.InvalidEtherTypeException(ethertype=ip_version)