X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fpacket%2FEthernet.java;h=d0068564a93b29a326395b1e6cae9eeacf968a53;hb=9d1246d4e9e3d83df2f5c6c66f3ac14e72b095c1;hp=0f1a7f54f3e7b537d14a77a930f6126ab9d74f31;hpb=340a93f17c03395391339a82b3a036afd374f569;p=controller.git diff --git a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/Ethernet.java b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/Ethernet.java index 0f1a7f54f3..d0068564a9 100644 --- a/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/Ethernet.java +++ b/opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/Ethernet.java @@ -13,16 +13,13 @@ import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.opendaylight.controller.sal.utils.EtherTypes; +import org.opendaylight.controller.sal.utils.NetUtils; /** * Class that represents the Ethernet frame objects - * - * */ public class Ethernet extends Packet { private static final String DMAC = "DestinationMACAddress"; @@ -37,6 +34,10 @@ public class Ethernet extends Packet { etherTypeClassMap.put(EtherTypes.ARP.shortValue(), ARP.class); etherTypeClassMap.put(EtherTypes.IPv4.shortValue(), IPv4.class); etherTypeClassMap.put(EtherTypes.LLDP.shortValue(), LLDP.class); + etherTypeClassMap.put(EtherTypes.VLANTAGGED.shortValue(), IEEE8021Q.class); + etherTypeClassMap.put(EtherTypes.OLDQINQ.shortValue(), IEEE8021Q.class); + etherTypeClassMap.put(EtherTypes.QINQ.shortValue(), IEEE8021Q.class); + etherTypeClassMap.put(EtherTypes.CISCOQINQ.shortValue(), IEEE8021Q.class); } private static Map> fieldCoordinates = new LinkedHashMap>() { private static final long serialVersionUID = 1L; @@ -46,7 +47,7 @@ public class Ethernet extends Packet { put(ETHT, new ImmutablePair(96, 16)); } }; - private Map fieldValues; + private final Map fieldValues; /** * Default constructor that creates and sets the HashMap @@ -102,6 +103,14 @@ public class Ethernet extends Packet { return BitBufferHelper.getShort(fieldValues.get(ETHT)); } + public boolean isBroadcast(){ + return NetUtils.isBroadcastMACAddr(getDestinationMACAddress()); + } + + public boolean isMulticast(){ + return NetUtils.isMulticastMACAddr(getDestinationMACAddress()); + } + /** * Sets the destination MAC address for the current Ethernet object instance * @param byte[] - the destinationMACAddress to set @@ -130,14 +139,4 @@ public class Ethernet extends Packet { return this; } - @Override - public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); - } - - @Override - public boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - }