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)
13 public class DlVlanPriority extends MatchField<Byte> {
14 private static final long serialVersionUID = 1L;
15 public static final String TYPE = "DL_VLAN_PR";
16 private static final byte MAX = 7;
17 private byte vlanPriority;
20 * Creates a Match field for the data layer type
25 public DlVlanPriority(byte vlanPriority) {
27 this.vlanPriority = vlanPriority;
31 private DlVlanPriority() {
36 public Byte getValue() {
41 @XmlElement(name = "mask")
42 protected String getValueString() {
43 return String.format("0X%s", Integer.toHexString(NetUtils.getUnsignedByte(vlanPriority)));
47 public Byte getMask() {
52 protected String getMaskString() {
57 public boolean isValid() {
58 return vlanPriority >= 0 && vlanPriority <= MAX;
62 public boolean hasReverse() {
67 public DlVlanPriority getReverse() {
72 public DlVlanPriority clone() {
73 return new DlVlanPriority(vlanPriority);
77 public boolean isV6() {
82 public int hashCode() {
85 result = prime * result + vlanPriority;
90 public boolean equals(Object obj) {
97 if (!(obj instanceof DlVlanPriority)) {
100 DlVlanPriority other = (DlVlanPriority) obj;
101 if (vlanPriority != other.vlanPriority) {