b12e14a9a566e5327174bcc633cb81ad16d2b4b6
[netvirt.git] / vpnservice / aclservice / api / src / main / java / org / opendaylight / netvirt / aclservice / api / utils / AclInterface.java
1 /*
2  * Copyright (c) 2016 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.aclservice.api.utils;
9
10 import java.math.BigInteger;
11 import java.util.List;
12
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
15
16 /**
17  * The Class AclInterface.
18  */
19 public class AclInterface {
20
21     /** The port security enabled. */
22     Boolean portSecurityEnabled;
23
24     /** The interface id. */
25     String interfaceId;
26
27     /** The l port tag. */
28     Integer lportTag;
29
30     /** The dp id. */
31     BigInteger dpId;
32
33     /** The security groups. */
34     List<Uuid> securityGroups;
35
36     /** The allowed address pairs. */
37     List<AllowedAddressPairs> allowedAddressPairs;
38
39     /**
40      * Checks if is port security enabled.
41      *
42      * @return the boolean
43      */
44     public Boolean isPortSecurityEnabled() {
45         return portSecurityEnabled;
46     }
47
48     /**
49      * Gets the port security enabled.
50      *
51      * @return the port security enabled
52      */
53     public Boolean getPortSecurityEnabled() {
54         return portSecurityEnabled;
55     }
56
57     /**
58      * Sets the port security enabled.
59      *
60      * @param portSecurityEnabled the new port security enabled
61      */
62     public void setPortSecurityEnabled(Boolean portSecurityEnabled) {
63         this.portSecurityEnabled = portSecurityEnabled;
64     }
65
66     /**
67      * Gets the interface id.
68      *
69      * @return the interface id
70      */
71     public String getInterfaceId() {
72         return interfaceId;
73     }
74
75     /**
76      * Sets the interface id.
77      *
78      * @param interfaceId the new interface id
79      */
80     public void setInterfaceId(String interfaceId) {
81         this.interfaceId = interfaceId;
82     }
83
84     /**
85      * Gets the l port tag.
86      *
87      * @return the l port tag
88      */
89     public Integer getLPortTag() {
90         return lportTag;
91     }
92
93     /**
94      * Sets the l port tag.
95      *
96      * @param lportTag the new l port tag
97      */
98     public void setLPortTag(Integer lportTag) {
99         this.lportTag = lportTag;
100     }
101
102     /**
103      * Gets the dp id.
104      *
105      * @return the dp id
106      */
107     public BigInteger getDpId() {
108         return dpId;
109     }
110
111     /**
112      * Sets the dp id.
113      *
114      * @param dpId the new dp id
115      */
116     public void setDpId(BigInteger dpId) {
117         this.dpId = dpId;
118     }
119
120     /**
121      * Gets the security groups.
122      *
123      * @return the security groups
124      */
125     public List<Uuid> getSecurityGroups() {
126         return securityGroups;
127     }
128
129     /**
130      * Sets the security groups.
131      *
132      * @param securityGroups the new security groups
133      */
134     public void setSecurityGroups(List<Uuid> securityGroups) {
135         this.securityGroups = securityGroups;
136     }
137
138     /**
139      * Gets the allowed address pairs.
140      *
141      * @return the allowed address pairs
142      */
143     public List<AllowedAddressPairs> getAllowedAddressPairs() {
144         return allowedAddressPairs;
145     }
146
147     /**
148      * Sets the allowed address pairs.
149      *
150      * @param allowedAddressPairs the new allowed address pairs
151      */
152     public void setAllowedAddressPairs(List<AllowedAddressPairs> allowedAddressPairs) {
153         this.allowedAddressPairs = allowedAddressPairs;
154     }
155
156     /* (non-Javadoc)
157      * @see java.lang.Object#hashCode()
158      */
159     @Override
160     public int hashCode() {
161         final int prime = 31;
162         int result = 1;
163         result = prime * result + ((portSecurityEnabled == null) ? 0 : portSecurityEnabled.hashCode());
164         result = prime * result + ((dpId == null) ? 0 : dpId.hashCode());
165         result = prime * result + ((interfaceId == null) ? 0 : interfaceId.hashCode());
166         result = prime * result + ((lportTag == null) ? 0 : lportTag.hashCode());
167         result = prime * result + ((securityGroups == null) ? 0 : securityGroups.hashCode());
168         result = prime * result + ((allowedAddressPairs == null) ? 0 : allowedAddressPairs.hashCode());
169         return result;
170     }
171
172     /* (non-Javadoc)
173      * @see java.lang.Object#equals(java.lang.Object)
174      */
175     @Override
176     public boolean equals(Object obj) {
177         if (this == obj) {
178             return true;
179         }
180         if (obj == null) {
181             return false;
182         }
183         if (getClass() != obj.getClass()) {
184             return false;
185         }
186         AclInterface other = (AclInterface) obj;
187         if (portSecurityEnabled == null) {
188             if (other.portSecurityEnabled != null) {
189                 return false;
190             }
191         } else if (!portSecurityEnabled.equals(other.portSecurityEnabled)) {
192             return false;
193         }
194         if (dpId == null) {
195             if (other.dpId != null) {
196                 return false;
197             }
198         } else if (!dpId.equals(other.dpId)) {
199             return false;
200         }
201         if (interfaceId == null) {
202             if (other.interfaceId != null) {
203                 return false;
204             }
205         } else if (!interfaceId.equals(other.interfaceId)) {
206             return false;
207         }
208         if (lportTag == null) {
209             if (other.lportTag != null) {
210                 return false;
211             }
212         } else if (!lportTag.equals(other.lportTag)) {
213             return false;
214         }
215         if (securityGroups == null) {
216             if (other.securityGroups != null) {
217                 return false;
218             }
219         } else if (!securityGroups.equals(other.securityGroups)) {
220             return false;
221         }
222         if (allowedAddressPairs == null) {
223             if (other.allowedAddressPairs != null) {
224                 return false;
225             }
226         } else if (!allowedAddressPairs.equals(other.allowedAddressPairs)) {
227             return false;
228         }
229         return true;
230     }
231
232     /* (non-Javadoc)
233      * @see java.lang.Object#toString()
234      */
235     @Override
236     public String toString() {
237         return "AclInterface [portSecurityEnabled=" + portSecurityEnabled + ", interfaceId=" + interfaceId
238                 + ", lportTag=" + lportTag + ", dpId=" + dpId + ", securityGroups=" + securityGroups
239                 + ", allowedAddressPairs=" + allowedAddressPairs + "]";
240     }
241 }