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=235e71a760faa01eb9cf9d2acf92a73c8acf00ce;hb=c7551f594c34504fffa0055d3360132577938b38;hp=c96e90156178803f7d835f5369a6892054cbcc39;hpb=66b4fbc0fd997591f71745f514013484abb30175;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 c96e901561..235e71a760 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 @@ -15,7 +15,10 @@ import java.util.Map; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; +import org.opendaylight.controller.sal.match.Match; +import org.opendaylight.controller.sal.match.MatchType; import org.opendaylight.controller.sal.utils.EtherTypes; +import org.opendaylight.controller.sal.utils.NetUtils; /** * Class that represents the Ethernet frame objects @@ -33,6 +36,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; @@ -98,6 +105,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 @@ -126,4 +141,10 @@ public class Ethernet extends Packet { return this; } + @Override + public void populateMatch(Match match) { + match.setField(MatchType.DL_SRC, this.getSourceMACAddress()); + match.setField(MatchType.DL_DST, this.getDestinationMACAddress()); + match.setField(MatchType.DL_TYPE, this.getEtherType()); + } }