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