Bug 7024: When router is associated to L3VPN , VRF entry creations takes
[netvirt.git] / vpnservice / vpnmanager / 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 MacAddress macAddress;
16     private InetAddress ipAddress;
17     private String interfaceName;
18
19     public MacEntry(String vpnName, MacAddress macAddress,
20             InetAddress inetAddress, String interfaceName) {
21         this.vpnName = vpnName;
22         this.macAddress = macAddress;
23         this.ipAddress = inetAddress;
24         this.interfaceName = interfaceName;
25     }
26
27     public String getVpnName() {
28         return vpnName;
29     }
30
31     public void setVpnName(String vpnName) {
32         this.vpnName = vpnName;
33     }
34
35     public MacAddress getMacAddress() {
36         return macAddress;
37     }
38
39     public String getInterfaceName() {
40         return interfaceName;
41     }
42
43     public void setInterfaceName(String interfaceName) {
44         this.interfaceName = interfaceName;
45     }
46
47     public InetAddress getIpAddress() {
48         return ipAddress;
49     }
50
51     @Override
52     public int hashCode() {
53         final int prime = 31;
54         int result = 1;
55         result = prime * result
56                 + ((macAddress == null) ? 0 : macAddress.hashCode());
57         return result;
58     }
59
60     @Override
61     public boolean equals(Object obj) {
62         boolean result = false;
63         if (getClass() != obj.getClass())
64             return result;
65         else {
66             MacEntry other = (MacEntry) obj;
67             result = vpnName.equals(other.vpnName) && macAddress.equals(other.macAddress)
68                     && ipAddress.equals(other.ipAddress) && interfaceName.equals(other.interfaceName);
69         }
70         return result;
71     }
72
73     @Override
74     public String toString() {
75         return "MacEntry [vpnName=" + vpnName + ", macAddress=" + macAddress + ", ipAddress=" + ipAddress
76                 + ", interfaceName=" + interfaceName + "]";
77     }
78 }