2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.sal.action;
11 import java.util.Arrays;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
18 import org.opendaylight.controller.sal.utils.HexEncode;
21 * Set destination datalayer address action
24 @XmlAccessorType(XmlAccessType.NONE)
25 public class SetDlDst extends Action {
26 private static final long serialVersionUID = 1L;
27 private byte[] address;
29 /* Dummy constructor for JAXB */
30 @SuppressWarnings("unused")
34 public SetDlDst(byte[] dlAddress) {
35 type = ActionType.SET_DL_DST;
36 this.address = dlAddress.clone();
40 * Returns the datalayer address that this action will set
44 public byte[] getDlAddress() {
45 return address.clone();
48 @XmlElement(name = "address")
49 public String getDlAddressString() {
50 return HexEncode.bytesToHexString(address);
54 public boolean equals(Object obj) {
58 if (!super.equals(obj)) {
61 if (getClass() != obj.getClass()) {
64 SetDlDst other = (SetDlDst) obj;
65 if (!Arrays.equals(address, other.address)) {
72 public int hashCode() {
74 int result = super.hashCode();
75 result = prime * result + Arrays.hashCode(address);
80 public String toString() {
81 return type + "[address = " + HexEncode.bytesToHexString(address) + "]";