Package org.onlab.packet
Class MacAddress
- java.lang.Object
- 
- org.onlab.packet.MacAddress
 
- 
 public class MacAddress extends Object The class representing MAC address.
- 
- 
Field SummaryFields Modifier and Type Field Description static MacAddressBROADCASTBroadcast MAC address.static MacAddressEXACT_MASKMask that indicates exact match on the MacAddress.static MacAddressIPV4_MULTICASTIPv4 multicast MAC address.static MacAddressIPV4_MULTICAST_MASKIPv4 multicast MAC mask.static MacAddressIPV6_MULTICASTIPv6 multicast MAC address.static MacAddressIPV6_MULTICAST_MASKIPv6 multicast MAC mask.static MacAddressLACPLACP MAC address.static Set<MacAddress>LLDPA set of LLDP MAC addresses.static intMAC_ADDRESS_LENGTHstatic MacAddressNONEDummy MAC address.static MacAddressONOSFirst MAC address in ONOS OUI range.static MacAddressONOS_LLDPONOS LLDP MAC address with slow protocol destination address.static MacAddressZEROAll-zero MAC address.
 - 
Constructor SummaryConstructors Constructor Description MacAddress(byte[] address)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)inthashCode()booleaninRange(MacAddress macAddr, MacAddress maskAddr)Checks if the Mac Address is inside a range defined by macAddr and mask.booleanisBroadcast()Returnstrueif the MAC address is the broadcast address.booleanisLldp()Returns true if this MAC address is used by link layer discovery protocol.booleanisMulticast()Returnstrueif the MAC address is the multicast address.booleanisOnos()Returns true if the Organizationally Unique Identifier (OUI) of this MAC address matches ONOS OUI.intlength()Returns the length of theMACAddress.byte[]oui()Returns the Organizationally Unique Identifier (OUI) of this MAC address.byte[]toBytes()Returns the value of theMACAddressas abytearray.longtoLong()Returns the value of theMACAddressas along.StringtoString()StringtoStringNoColon()static MacAddressvalueOf(byte[] address)Returns a MAC address instance representing the specifiedbytearray.static MacAddressvalueOf(long address)Returns a MAC address instance representing the specifiedlongvalue.static MacAddressvalueOf(String address)Returns a MAC address instance representing the value of the specifiedString.
 
- 
- 
- 
Field Detail- 
ONOSpublic static final MacAddress ONOS First MAC address in ONOS OUI range.
 - 
NONEpublic static final MacAddress NONE Dummy MAC address. We use the first MAC address in ONOS OUI range as the dummy MAC address.
 - 
ONOS_LLDPpublic static final MacAddress ONOS_LLDP ONOS LLDP MAC address with slow protocol destination address.
 - 
ZEROpublic static final MacAddress ZERO All-zero MAC address.
 - 
BROADCASTpublic static final MacAddress BROADCAST Broadcast MAC address.
 - 
EXACT_MASKpublic static final MacAddress EXACT_MASK Mask that indicates exact match on the MacAddress.
 - 
IPV4_MULTICASTpublic static final MacAddress IPV4_MULTICAST IPv4 multicast MAC address.
 - 
IPV4_MULTICAST_MASKpublic static final MacAddress IPV4_MULTICAST_MASK IPv4 multicast MAC mask.
 - 
IPV6_MULTICASTpublic static final MacAddress IPV6_MULTICAST IPv6 multicast MAC address.
 - 
IPV6_MULTICAST_MASKpublic static final MacAddress IPV6_MULTICAST_MASK IPv6 multicast MAC mask.
 - 
LLDPpublic static final Set<MacAddress> LLDP A set of LLDP MAC addresses.
 - 
LACPpublic static final MacAddress LACP LACP MAC address.
 - 
MAC_ADDRESS_LENGTHpublic static final int MAC_ADDRESS_LENGTH - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
valueOfpublic static MacAddress valueOf(String address) Returns a MAC address instance representing the value of the specifiedString.- Parameters:
- address- the String representation of the MAC Address to be parsed.
- Returns:
- a MAC Address instance representing the value of the specified
 String.
- Throws:
- IllegalArgumentException- if the string cannot be parsed as a MAC address.
 
 - 
valueOfpublic static MacAddress valueOf(byte[] address) Returns a MAC address instance representing the specifiedbytearray.- Parameters:
- address- the byte array to be parsed.
- Returns:
- a MAC address instance representing the specified bytearray.
- Throws:
- IllegalArgumentException- if the byte array cannot be parsed as a MAC address.
 
 - 
valueOfpublic static MacAddress valueOf(long address) Returns a MAC address instance representing the specifiedlongvalue. The lower 48 bits of the long value are used to parse as a MAC address.- Parameters:
- address- the long value to be parsed. The lower 48 bits are used for a MAC address.
- Returns:
- a MAC address instance representing the specified longvalue.
- Throws:
- IllegalArgumentException- if the long value cannot be parsed as a MAC address.
 
 - 
lengthpublic int length() Returns the length of theMACAddress.- Returns:
- the length of the MACAddress.
 
 - 
toBytespublic byte[] toBytes() Returns the value of theMACAddressas abytearray.- Returns:
- the numeric value represented by this object after conversion to
 type bytearray.
 
 - 
toLongpublic long toLong() Returns the value of theMACAddressas along.- Returns:
- the numeric value represented by this object after conversion to
 type long.
 
 - 
isBroadcastpublic boolean isBroadcast() Returnstrueif the MAC address is the broadcast address.- Returns:
- trueif the MAC address is the broadcast address.
 
 - 
isMulticastpublic boolean isMulticast() Returnstrueif the MAC address is the multicast address.- Returns:
- trueif the MAC address is the multicast address.
 
 - 
isLldppublic boolean isLldp() Returns true if this MAC address is used by link layer discovery protocol.- Returns:
- true if this MAC is LLDP MAC.
 
 - 
isOnospublic boolean isOnos() Returns true if the Organizationally Unique Identifier (OUI) of this MAC address matches ONOS OUI.- Returns:
- true if the OUI of this MAC address matches ONOS OUI.
 
 - 
ouipublic byte[] oui() Returns the Organizationally Unique Identifier (OUI) of this MAC address.- Returns:
- the OUI of this MAC address.
 
 - 
toStringNoColonpublic String toStringNoColon() - Returns:
- MAC address in string representation without colons (useful for radix tree storage)
 
 - 
inRangepublic boolean inRange(MacAddress macAddr, MacAddress maskAddr) Checks if the Mac Address is inside a range defined by macAddr and mask.- Parameters:
- macAddr- the mac address
- maskAddr- the mask
- Returns:
- true if in range, false otherwise.
 
 
- 
 
-