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.hosttracker.hostAware.HostNodeConnector;
15 import org.opendaylight.controller.switchmanager.Subnet;
17 * ARP Request event wrapper Consists of IP and Subnet (and a
18 * HostNodeConnector if is unicast) For unicast request, construct with a
21 public class ARPRequest extends ARPEvent {
22 private final Subnet subnet;
23 private final HostNodeConnector host;
26 public int hashCode() {
28 int result = super.hashCode();
29 result = prime * result + ((host == null) ? 0 : host.hashCode());
30 result = prime * result + ((subnet == null) ? 0 : subnet.hashCode());
35 public boolean equals(Object obj) {
42 if (!(obj instanceof ARPRequest)) {
45 ARPRequest other = (ARPRequest) obj;
47 if (other.host != null) {
50 } else if (!host.equals(other.host)) {
54 if (other.subnet != null) {
57 } else if (!subnet.equals(other.subnet)) {
64 public ARPRequest(InetAddress ip, Subnet subnet) {
71 public ARPRequest(HostNodeConnector host, Subnet subnet) {
72 super(host.getNetworkAddress());
77 public Subnet getSubnet() {
81 public HostNodeConnector getHost() {
88 * @see java.lang.Object#toString()
91 public String toString() {
92 StringBuilder builder = new StringBuilder();
93 builder.append("ARPRequest [");
95 builder.append("subnet=")
100 builder.append("host=")
104 return builder.toString();