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.NetUtils;
11 @XmlAccessorType(XmlAccessType.NONE)
12 public class DlVlanPriority extends MatchField<Byte> {
13 private static final long serialVersionUID = 1L;
14 public static final String TYPE = "DL_VLAN_PR";
15 private static final byte MAX = 7;
16 private byte vlanPriority;
19 * Creates a Match field for the data layer type
24 public DlVlanPriority(byte vlanPriority) {
26 this.vlanPriority = vlanPriority;
30 private DlVlanPriority() {
35 public Byte getValue() {
40 @XmlElement(name = "mask")
41 protected String getValueString() {
42 return String.format("0X%s", Integer.toHexString(NetUtils.getUnsignedByte(vlanPriority)));
46 public Byte getMask() {
51 protected String getMaskString() {
56 public boolean isValid() {
57 return vlanPriority >= 0 && vlanPriority <= MAX;
61 public boolean hasReverse() {
66 public DlVlanPriority getReverse() {
71 public DlVlanPriority clone() {
72 return new DlVlanPriority(vlanPriority);
76 public boolean isV6() {
81 public int hashCode() {
84 result = prime * result + vlanPriority;
89 public boolean equals(Object obj) {
96 if (!(obj instanceof DlVlanPriority)) {
99 DlVlanPriority other = (DlVlanPriority) obj;
100 if (vlanPriority != other.vlanPriority) {