1 package org.opendaylight.controller.sal.match.extensible;
3 import javax.xml.bind.annotation.XmlAccessType;
4 import javax.xml.bind.annotation.XmlAccessorType;
5 import javax.xml.bind.annotation.XmlElement;
6 import javax.xml.bind.annotation.XmlRootElement;
8 import org.opendaylight.controller.sal.utils.EtherTypes;
9 import org.opendaylight.controller.sal.utils.NetUtils;
12 @XmlAccessorType(XmlAccessType.NONE)
14 public class DlType extends MatchField<Short> {
15 private static final long serialVersionUID = 1L;
16 public static final String TYPE = "DL_TYPE";
17 private short ethertype;
20 * Creates a Match field for the data layer type
25 public DlType(short ethertype) {
27 this.ethertype = ethertype;
36 public Short getValue() {
41 @XmlElement(name = "value")
42 protected String getValueString() {
43 return String.format("0X%s", Integer.toHexString(NetUtils.getUnsignedShort(ethertype)));
47 public Short getMask() {
52 protected String getMaskString() {
57 public boolean isValid() {
62 public boolean hasReverse() {
67 public DlType getReverse() {
72 public DlType clone() {
73 return new DlType(ethertype);
77 public boolean isV6() {
78 return this.ethertype == EtherTypes.IPv6.shortValue();
82 public int hashCode() {
85 result = prime * result + ethertype;
90 public boolean equals(Object obj) {
97 if (!(obj instanceof DlType)) {
100 DlType other = (DlType) obj;
101 if (ethertype != other.ethertype) {