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 NwTos extends MatchField<Byte> {
14 private static final long serialVersionUID = 1L;
15 public static final String TYPE = "NW_TOS";
16 private static final short MAX = 63;
20 * Creates a Match field for the network TOS
25 public NwTos(byte tos) {
30 public NwTos(int tos) {
32 this.tos = (byte) tos;
35 public NwTos(short tos) {
37 this.tos = (byte) tos;
46 public Byte getValue() {
51 @XmlElement(name = "value")
52 protected String getValueString() {
53 return String.format("0X%s", Integer.toHexString(NetUtils.getUnsignedByte(tos)));
57 public Byte getMask() {
62 protected String getMaskString() {
67 public boolean isValid() {
68 return tos >= 0 && tos <= MAX;
72 public boolean hasReverse() {
77 public NwTos getReverse() {
82 public NwTos clone() {
83 return new NwTos(tos);
87 public boolean isV6() {
92 public int hashCode() {
95 result = prime * result + tos;
100 public boolean equals(Object obj) {
107 if (!(obj instanceof NwTos)) {
110 NwTos other = (NwTos) obj;
111 if (tos != other.tos) {