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;
14 import org.opendaylight.controller.arphandler.ARPEvent;
15 import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
16 import org.opendaylight.controller.switchmanager.Subnet;
18 * ARP Request event wrapper Consists of IP and Subnet (and a
19 * HostNodeConnector if is unicast) For unicast request, construct with a
22 public class ARPRequest extends ARPEvent {
23 private final Subnet subnet;
24 private final HostNodeConnector host;
27 public int hashCode() {
29 int result = super.hashCode();
30 result = prime * result + ((host == null) ? 0 : host.hashCode());
31 result = prime * result + ((subnet == null) ? 0 : subnet.hashCode());
36 public boolean equals(Object obj) {
43 if (!(obj instanceof ARPRequest)) {
46 ARPRequest other = (ARPRequest) obj;
48 if (other.host != null) {
51 } else if (!host.equals(other.host)) {
55 if (other.subnet != null) {
58 } else if (!subnet.equals(other.subnet)) {
65 public ARPRequest(InetAddress ip, Subnet subnet) {
72 public ARPRequest(HostNodeConnector host, Subnet subnet) {
73 super(host.getNetworkAddress());
78 public Subnet getSubnet() {
82 public HostNodeConnector getHost() {
89 * @see java.lang.Object#toString()
92 public String toString() {
93 StringBuilder builder = new StringBuilder();
94 builder.append("ARPRequest [");
96 builder.append("subnet=")
101 builder.append("host=")
105 return builder.toString();