Add checkstyle rule to prevent empty statements (;)
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / packet / Ethernet.java
index c96e90156178803f7d835f5369a6892054cbcc39..d0068564a93b29a326395b1e6cae9eeacf968a53 100644 (file)
@@ -16,6 +16,7 @@ import java.util.Map;
 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
@@ -33,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<String, Pair<Integer, Integer>> fieldCoordinates = new LinkedHashMap<String, Pair<Integer, Integer>>() {
         private static final long serialVersionUID = 1L;
@@ -98,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