3 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
5 * This program and the accompanying materials are made available under the
6 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 * and is available at http://www.eclipse.org/legal/epl-v10.html
10 package org.opendaylight.controller.sal.core;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
17 import org.apache.commons.lang3.builder.HashCodeBuilder;
18 import org.apache.commons.lang3.builder.EqualsBuilder;
19 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
22 * The class contains the controller MAC address and node MAC address.
27 @XmlAccessorType(XmlAccessType.NONE)
28 public class MacAddress extends Property {
29 private static final long serialVersionUID = 1L;
31 private byte[] controllerMacAddress;
33 private byte[] nodeMacAddress;
34 public static final String MacPropName = "macAddress";
37 * Private constructor used for JAXB mapping
39 private MacAddress() {
41 this.controllerMacAddress = null;
42 this.nodeMacAddress = null;
46 * Constructor to create DatalinkAddress property which contains the
47 * controller MAC address and node MAC address. The property will be
48 * attached to a {@link org.opendaylight.controller.sal.core.Node}.
50 * @param controllerMacAddress Data Link Address for the controller
51 * @param nodeMacAddress Data Link Address for the node
53 * @return the constructed object
55 public MacAddress(byte[] controllerMacAddress, byte[] nodeMacAddress) {
58 this.controllerMacAddress = controllerMacAddress;
59 this.nodeMacAddress = nodeMacAddress;
63 * @return the controller MAC address
65 public byte[] getControllerMacAddress() {
66 return this.controllerMacAddress;
70 * @return the node MAC address
72 public byte[] getNodeMacAddress() {
73 return this.nodeMacAddress;
76 public MacAddress clone() {
77 return new MacAddress(this.controllerMacAddress, this.nodeMacAddress);
81 public int hashCode() {
82 return HashCodeBuilder.reflectionHashCode(this);
86 public boolean equals(Object obj) {
87 return EqualsBuilder.reflectionEquals(this, obj);
91 public String toString() {
92 return "MacAddress[" + ReflectionToStringBuilder.toString(this) + "]";