VPN-to-Router Associate/Disas Performance Improve
[netvirt.git] / vpnmanager / impl / src / main / java / org / opendaylight / netvirt / vpnmanager / MacEntry.java
1 /*
2  * Copyright (c) 2015 Ericsson India Global Services Pvt Ltd. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.netvirt.vpnmanager;
9
10 import java.net.InetAddress;
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
12
13 public class MacEntry {
14     private String vpnName;
15     private final MacAddress macAddress;
16     private final InetAddress ipAddress;
17     private String interfaceName;
18     private final String createdTime;
19
20     public MacEntry(String vpnName, MacAddress macAddress, InetAddress inetAddress,
21                     String interfaceName, String createdTime) {
22         this.vpnName = vpnName;
23         this.macAddress = macAddress;
24         this.ipAddress = inetAddress;
25         this.interfaceName = interfaceName;
26         this.createdTime = createdTime;
27     }
28
29     public String getVpnName() {
30         return vpnName;
31     }
32
33     public void setVpnName(String vpnName) {
34         this.vpnName = vpnName;
35     }
36
37     public MacAddress getMacAddress() {
38         return macAddress;
39     }
40
41     public String getInterfaceName() {
42         return interfaceName;
43     }
44
45     public void setInterfaceName(String interfaceName) {
46         this.interfaceName = interfaceName;
47     }
48
49     public InetAddress getIpAddress() {
50         return ipAddress;
51     }
52
53     public String getCreatedTime() {
54         return  createdTime;
55     }
56
57     @Override
58     public int hashCode() {
59         final int prime = 31;
60         int result = 1;
61         result = prime * result
62             + (macAddress == null ? 0 : macAddress.hashCode());
63         return result;
64     }
65
66     @Override
67     public boolean equals(Object obj) {
68         if (obj == null) {
69             return false;
70         }
71
72         if (getClass() != obj.getClass()) {
73             return false;
74         } else {
75             MacEntry other = (MacEntry) obj;
76             return vpnName.equals(other.vpnName)
77                     && macAddress.equals(other.macAddress)
78                     && ipAddress.equals(other.ipAddress)
79                     && interfaceName.equals(other.interfaceName)
80                     && createdTime.equals(other.getCreatedTime());
81         }
82     }
83
84     @Override
85     public String toString() {
86         return "MacEntry [vpnName=" + vpnName + ", macAddress=" + macAddress + ", ipAddress=" + ipAddress
87             + ", interfaceName=" + interfaceName + ", createdTime=" + createdTime + "]";
88     }
89 }