Checkstyle Import issues fix (SPI, Model)
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronBgpvpn.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
9 package org.opendaylight.neutron.spi;
10
11 import java.io.Serializable;
12 import java.util.Iterator;
13 import java.util.List;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
18
19 @XmlRootElement(name = "bgpvpn")
20 @XmlAccessorType(XmlAccessType.NONE)
21 public class NeutronBgpvpn extends NeutronObject implements Serializable, INeutronObject {
22     // See OpenStack Network API v2.0 Reference for description of
23     // annotated attributes
24
25     private static final long serialVersionUID = 1L;
26
27     @XmlElement (name = "name")
28     String bgpvpnName;
29
30     @XmlElement (defaultValue = "true", name = "admin_state_up")
31     Boolean adminStateUp;
32
33     @XmlElement (name = "status")
34     String status;
35
36     @XmlElement (defaultValue = "l3", name = "type")
37     String type;
38
39     @XmlElement (name = "technique")
40     String technique;
41
42     @XmlElement (name = "route_targets")
43     List<String> routeTargets;
44
45     @XmlElement (name = "import_targets")
46     List<String> importTargets;
47
48     @XmlElement (name = "export_targets")
49     List<String> exportTargets;
50
51     @XmlElement (name = "route_distinguishers")
52     List<String> routeDistinguishers;
53
54     @XmlElement (name="vnid")
55     Long vnid;
56
57     @XmlElement (defaultValue="false", name="auto_aggregate")
58     Boolean autoAggregate;
59
60     @XmlElement (name = "networks")
61     List<String> networks;
62
63     @XmlElement (name = "routers")
64     List<String> routers;
65
66     /* This attribute lists the ports associated with an instance
67      * which is needed for determining if that instance can be deleted
68      */
69
70     public NeutronBgpvpn() {
71     }
72
73     public void initDefaults() {
74         if (type == null) {
75             type = "l3";
76         }
77         if (status == null) {
78             status = "ACTIVE";
79         }
80         if (adminStateUp == null) {
81             adminStateUp = true;
82         }
83         if (autoAggregate == null) {
84             autoAggregate = false;
85         }
86     }
87
88     public String getBgpvpnName() {
89         return bgpvpnName;
90     }
91
92     public void setBgpvpnName(String bgpvpnName) {
93         this.bgpvpnName = bgpvpnName;
94     }
95
96     public boolean isAdminStateUp() {
97         return adminStateUp;
98     }
99
100     public Boolean getAdminStateUp() { return adminStateUp; }
101
102     public void setAdminStateUp(boolean newValue) {
103         adminStateUp = newValue;
104     }
105
106     public String getStatus() {
107         return status;
108     }
109
110     public void setStatus(String status) {
111         this.status = status;
112     }
113
114     public boolean isAutoAggregate() {
115         return autoAggregate;
116     }
117
118     public String getType() {
119         return type;
120     }
121
122     public void setType(String type) {
123         this.type = type;
124     }
125
126     public String getTechnique() {
127         return technique;
128     }
129
130     public void setTechnique(String technique) {
131         this.technique = technique;
132     }
133
134     public List<String> getRouteTargets() {
135         return routeTargets;
136     }
137
138     public void setRouteTargets(List<String> routeTargets) {
139         this.routeTargets= routeTargets;
140     }
141
142     public void addRouteTarget(String uuid) {
143         routeTargets.add(uuid);
144     }
145
146     public void removeRouteTarget(String uuid) {
147         routeTargets.remove(uuid);
148     }
149
150     public List<String> getImportTargets() {
151         return importTargets;
152     }
153
154     public void setImportTargets(List<String> importTargets) {
155         this.importTargets = importTargets;
156     }
157
158     public void addImportTarget(String uuid) {
159         importTargets.add(uuid);
160     }
161
162     public void removeImportTarget(String uuid) {
163         importTargets.remove(uuid);
164     }
165
166     public List<String> getExportTargets() {
167         return exportTargets;
168     }
169
170     public void setExportTargets(List<String> exportTargets) {
171         this.exportTargets = exportTargets;
172     }
173
174     public void addExportTarget(String uuid) {
175         exportTargets.add(uuid);
176     }
177
178     public void removeExportTarget(String uuid) {
179         exportTargets.remove(uuid);
180     }
181
182     public List<String> getRouteDistinguishers() {
183         return routeDistinguishers;
184     }
185
186     public void setRouteDistinguishers(List<String> routeDistinguishers) {
187         this.routeDistinguishers = routeDistinguishers;
188     }
189
190     public void addRouteDistinguisher(String uuid) {
191         routeDistinguishers.add(uuid);
192     }
193
194     public void removeRouteDistinguisher(String uuid) {
195         routeDistinguishers.remove(uuid);
196     }
197
198     public Long getVnid() {
199         return vnid;
200     }
201
202     public void setVnid(Long input) {
203         vnid = input;
204     }
205
206     public Boolean getAutoAggregate() { return autoAggregate; }
207
208     public void setAutoAggregate(boolean newValue) {
209         autoAggregate = newValue;
210     }
211
212     public List<String> getNetworks() {
213         return networks;
214     }
215
216     public void setNetworks(List<String> networks) {
217         this.networks = networks;
218     }
219
220     public void addNetwork(String uuid) {
221         networks.add(uuid);
222     }
223
224     public void removeNetwork(String uuid) {
225         networks.remove(uuid);
226     }
227
228     public List<String> getRouters() {
229         return routers;
230     }
231
232     public void setRouters(List<String> routers) {
233         this.routers = routers;
234     }
235
236     public void addRouter(String uuid) {
237         routers.add(uuid);
238     }
239
240     public void removeRouter(String uuid) {
241         routers.remove(uuid);
242     }
243
244     /**
245      * This method copies selected fields from the object and returns them
246      * as a new object, suitable for marshaling.
247      *
248      * @param fields
249      *            List of attributes to be extracted
250      * @return an OpenStackNetworks object with only the selected fields
251      * populated
252      */
253
254     public NeutronBgpvpn extractFields(List<String> fields) {
255         NeutronBgpvpn ans = new NeutronBgpvpn();
256         Iterator<String> i = fields.iterator();
257         while (i.hasNext()) {
258             String s = i.next();
259             if (s.equals("id")) {
260                 ans.setID(this.getID());
261             }
262             if (s.equals("name")) {
263                 ans.setBgpvpnName(this.getBgpvpnName());
264             }
265             if (s.equals("admin_state_up")) {
266                 ans.setAdminStateUp(adminStateUp);
267             }
268             if (s.equals("status")) {
269                 ans.setStatus(this.getStatus());
270             }
271             if (s.equals("tenant_id")) {
272                 ans.setTenantID(this.getTenantID());
273             }
274             if (s.equals("type")) {
275                 ans.setType(this.getType());
276             }
277             if (s.equals("technique")) {
278                 ans.setTechnique(this.getTechnique());
279             }
280             if (s.equals("route_targets")) {
281                 ans.setRouteTargets(this.getRouteTargets());
282             }
283             if (s.equals("import_targets")) {
284                 ans.setImportTargets(this.getImportTargets());
285             }
286             if (s.equals("export_targets")) {
287                 ans.setExportTargets(this.getExportTargets());
288             }
289             if (s.equals("route_distinguishers")) {
290                 ans.setRouteDistinguishers(this.getRouteDistinguishers());
291             }
292             if (s.equals("routers")) {
293                 ans.setRouters(this.getRouters());
294             }
295             if (s.equals("networks")) {
296                 ans.setNetworks(this.getNetworks());
297             }
298             if (s.equals("vnid")) {
299                 ans.setVnid(this.getVnid());
300             }
301             if (s.equals("auto_aggregate")) {
302                 ans.setAutoAggregate(this.getAutoAggregate());
303             }
304         }
305         return ans;
306     }
307
308     @Override
309     public String toString() {
310         return "NeutronBgpvpn [bgpvpnUUID=" + uuid + ", bgpvpnName=" + bgpvpnName + ", adminStateUp="
311                 + adminStateUp + ", status=" + status + ", tenantID=" + tenantID + ", type=" + type
312                 + ", technique=" + technique + ", routeTargets="
313                 + routeTargets + ", importTargets=" + importTargets + ", exportTargets=" + exportTargets
314                 + ", routeDistinguishers=" + routeDistinguishers + ", vnid = " + vnid
315                 + ", autoAggregate = " + autoAggregate + ", networks = " + networks
316                 + ", routers = " + routers + "]";
317     }
318 }
319