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 source datalayer address action
25 @XmlAccessorType(XmlAccessType.NONE)
27 public class SetDlSrc extends Action {
28 private static final long serialVersionUID = 1L;
29 private byte[] address;
31 /* Dummy constructor for JAXB */
32 @SuppressWarnings("unused")
36 public SetDlSrc(byte[] dlAddress) {
37 type = ActionType.SET_DL_SRC;
38 if (dlAddress != null) {
39 this.address = dlAddress.clone();
46 * Returns the datalayer address that this action will set
50 public byte[] getDlAddress() {
51 return address.clone();
54 @XmlElement(name = "address")
55 public String getDlAddressString() {
56 return HexEncode.bytesToHexString(address);
60 public boolean equals(Object obj) {
64 if (!super.equals(obj)) {
67 if (getClass() != obj.getClass()) {
70 SetDlSrc other = (SetDlSrc) obj;
71 if (!Arrays.equals(address, other.address)) {
78 public int hashCode() {
80 int result = super.hashCode();
81 result = prime * result + Arrays.hashCode(address);
86 public String toString() {
87 return type + "[address = " + HexEncode.bytesToHexString(address) + "]";