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 NwTos extends MatchField<Byte> {
13 private static final long serialVersionUID = 1L;
14 public static final String TYPE = "NW_TOS";
15 private static final short MAX = 63;
19 * Creates a Match field for the network TOS
24 public NwTos(byte tos) {
29 public NwTos(int tos) {
31 this.tos = (byte) tos;
34 public NwTos(short tos) {
36 this.tos = (byte) tos;
45 public Byte getValue() {
50 @XmlElement(name = "value")
51 protected String getValueString() {
52 return String.format("0X%s", Integer.toHexString(NetUtils.getUnsignedByte(tos)));
56 public Byte getMask() {
61 protected String getMaskString() {
66 public boolean isValid() {
67 return tos >= 0 && tos <= MAX;
71 public boolean hasReverse() {
76 public NwTos getReverse() {
81 public NwTos clone() {
82 return new NwTos(tos);
86 public boolean isV6() {
91 public int hashCode() {
94 result = prime * result + tos;
99 public boolean equals(Object obj) {
106 if (!(obj instanceof NwTos)) {
109 NwTos other = (NwTos) obj;
110 if (tos != other.tos) {