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)
13 public class DlType extends MatchField<Short> {
14 private static final long serialVersionUID = 1L;
15 public static final String TYPE = "DL_TYPE";
16 private short ethertype;
19 * Creates a Match field for the data layer type
24 public DlType(short ethertype) {
26 this.ethertype = ethertype;
35 public Short getValue() {
40 @XmlElement(name = "value")
41 protected String getValueString() {
42 return String.format("0X%s", Integer.toHexString(NetUtils.getUnsignedShort(ethertype)));
46 public Short getMask() {
51 protected String getMaskString() {
56 public boolean isValid() {
61 public boolean hasReverse() {
66 public DlType getReverse() {
71 public DlType clone() {
72 return new DlType(ethertype);
76 public boolean isV6() {
77 return this.ethertype == EtherTypes.IPv6.shortValue();
81 public int hashCode() {
84 result = prime * result + ethertype;
89 public boolean equals(Object obj) {
96 if (!(obj instanceof DlType)) {
99 DlType other = (DlType) obj;
100 if (ethertype != other.ethertype) {