1 package org.opendaylight.controller.sal.match.extensible;
3 import java.util.Arrays;
5 import javax.xml.bind.annotation.XmlAccessType;
6 import javax.xml.bind.annotation.XmlAccessorType;
7 import javax.xml.bind.annotation.XmlElement;
8 import javax.xml.bind.annotation.XmlRootElement;
10 import org.opendaylight.controller.sal.utils.HexEncode;
11 import org.opendaylight.controller.sal.utils.NetUtils;
14 @XmlAccessorType(XmlAccessType.NONE)
16 public class DlDst extends MatchField<byte[]> {
17 private static final long serialVersionUID = 1L;
18 public static final String TYPE = "DL_DST";
19 private byte[] address;
22 * Creates a Match field for the destination data layer address
25 * the data layer address. The constructor makes a copy of it
27 public DlDst(byte[] address) {
29 if (address != null) {
30 this.address = Arrays.copyOf(address, address.length);
40 public byte[] getValue() {
41 return Arrays.copyOf(address, address.length);
45 @XmlElement(name = "value")
46 protected String getValueString() {
47 return HexEncode.bytesToHexStringFormat(address);
51 public byte[] getMask() {
56 protected String getMaskString() {
61 public boolean isValid() {
62 return address != null && address.length == NetUtils.MACAddrLengthInBytes;
66 public boolean hasReverse() {
71 public DlSrc getReverse() {
72 return new DlSrc(address);
76 public DlDst clone() {
77 return new DlDst(address);
81 public boolean isV6() {
86 public int hashCode() {
89 result = prime * result + Arrays.hashCode(address);
94 public boolean equals(Object obj) {
101 if (!(obj instanceof DlDst)) {
104 DlDst other = (DlDst) obj;
105 return Arrays.equals(address, other.address);