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.arphandler;
12 import java.net.InetAddress;
13 import java.util.Arrays;
15 import org.opendaylight.controller.sal.core.NodeConnector;
16 import org.opendaylight.controller.sal.utils.HexEncode;
18 * ARP Reply event wrapper
20 public class ARPReply extends ARPEvent {
21 private static final long serialVersionUID = 1L;
22 private final NodeConnector port;
23 private final byte[] tMac;
24 private final byte[] sMac;
25 private final InetAddress sIP;
28 public int hashCode() {
30 int result = super.hashCode();
31 result = prime * result + ((sIP == null) ? 0 : sIP.hashCode());
32 result = prime * result + Arrays.hashCode(sMac);
33 result = prime * result + Arrays.hashCode(tMac);
38 public boolean equals(Object obj) {
45 if (!(obj instanceof ARPReply)) {
48 ARPReply other = (ARPReply) obj;
50 if (other.sIP != null) {
53 } else if (!sIP.equals(other.sIP)) {
56 if (!Arrays.equals(sMac, other.sMac)) {
59 if (!Arrays.equals(tMac, other.tMac)) {
65 public ARPReply(NodeConnector port, InetAddress sIP, byte[] sMAC, InetAddress tIP, byte[] tMAC) {
73 public ARPReply(InetAddress tIP, byte[] tMAC) {
81 public byte[] getTargetMac() {
85 public byte[] getSourceMac() {
89 public InetAddress getSourceIP() {
93 public NodeConnector getPort() {
100 * @see java.lang.Object#toString()
103 public String toString() {
104 StringBuilder builder = new StringBuilder();
105 builder.append("ARPReply [");
107 builder.append("port=")
112 builder.append("tMac=")
113 .append(HexEncode.bytesToHexString(tMac))
117 builder.append("sMac=")
118 .append(HexEncode.bytesToHexString(sMac))
122 builder.append("sIP=")
126 return builder.toString();