OpenDaylight Controller functional modules.
[controller.git] / opendaylight / samples / simpleforwarding / src / main / java / org / opendaylight / controller / samples / simpleforwarding / internal / HostNodePair.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
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
8  */
9
10 package org.opendaylight.controller.samples.simpleforwarding.internal;
11
12 import java.io.Serializable;
13
14 import org.apache.commons.lang3.builder.EqualsBuilder;
15 import org.apache.commons.lang3.builder.HashCodeBuilder;
16 import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
17
18 import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
19 import org.opendaylight.controller.sal.core.Node;
20
21 /**
22  * Class that represent a pair of {Host, Node}, the intent of it
23  * is to be used as a key in the database kept by IPSwitching module
24  * where for every Host, Switch we will have a Forwarding Rule that
25  * will route the traffic toward the /32 destination
26  *
27  */
28 public class HostNodePair implements Serializable {
29     private static final long serialVersionUID = 1L;
30     private HostNodeConnector host;
31     private Node node;
32
33     public HostNodePair(HostNodeConnector h, Node s) {
34         setNode(s);
35         setHost(h);
36     }
37
38     public Node getNode() {
39         return node;
40     }
41
42     public void setNode(Node nodeId) {
43         this.node = nodeId;
44     }
45
46     public HostNodeConnector getHost() {
47         return host;
48     }
49
50     public void setHost(HostNodeConnector host) {
51         this.host = host;
52     }
53
54     @Override
55     public int hashCode() {
56         return HashCodeBuilder.reflectionHashCode(this);
57     }
58
59     @Override
60     public boolean equals(Object obj) {
61         return EqualsBuilder.reflectionEquals(this, obj);
62     }
63
64     @Override
65     public String toString() {
66         return "HostNodePair[" + ReflectionToStringBuilder.toString(this) + "]";
67     }
68 }