Merge "Code cleanup: ternary operator."
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronVpnIpSecSiteConnection.java
1 /*
2  * Copyright (c) 2015 IBM Corporation 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
19 @XmlAccessorType(XmlAccessType.NONE)
20 public final class NeutronVpnIpSecSiteConnection extends NeutronAdminAttributes<NeutronVpnIpSecSiteConnection>
21         implements Serializable {
22     private static final long serialVersionUID = 1L;
23
24     // See OpenStack Network API v2.0 Reference for description of
25     // annotated attributes
26
27     @XmlElement(name = "peer_address")
28     String peerAddress;
29
30     @XmlElement(name = "peer_id")
31     String peerID;
32
33     @XmlElement(name = "peer_cidrs")
34     List<String> peerCidrs;
35
36     @XmlElement(name = "route_mode")
37     String routeMode;
38
39     @XmlElement(name = "mtu")
40     Integer mtu;
41
42     @XmlElement(name = "auth_mode")
43     String authMode;
44
45     @XmlElement(name = "psk")
46     String preSharedKey;
47
48     @XmlElement(name = "initiator")
49     String initiator;
50
51     @XmlElement(name = "ikepolicy_id")
52     String ikePolicyID;
53
54     @XmlElement(name = "ipsecpolicy_id")
55     String ipsecPolicyID;
56
57     @XmlElement(name = "vpnservice_id")
58     String vpnServiceID;
59
60     @XmlElement(name = "dpd")
61     NeutronVpnDeadPeerDetection deadPeerDetection;
62
63     public NeutronVpnIpSecSiteConnection() {
64     }
65
66     public String getPeerAddress() {
67         return peerAddress;
68     }
69
70     public void setPeerAddress(String peerAddress) {
71         this.peerAddress = peerAddress;
72     }
73
74     public String getPeerID() {
75         return peerID;
76     }
77
78     public void setPeerID(String peerID) {
79         this.peerID = peerID;
80     }
81
82     public List<String> getPeerCidrs() {
83         return peerCidrs;
84     }
85
86     public void setPeerCidrs(List<String> peerCidrs) {
87         this.peerCidrs = peerCidrs;
88     }
89
90     public String getRouteMode() {
91         return routeMode;
92     }
93
94     public void setRouteMode(String routeMode) {
95         this.routeMode = routeMode;
96     }
97
98     public Integer getMtu() {
99         return mtu;
100     }
101
102     public void setMtu(Integer mtu) {
103         this.mtu = mtu;
104     }
105
106     public String getAuthMode() {
107         return authMode;
108     }
109
110     public void setAuthMode(String authMode) {
111         this.authMode = authMode;
112     }
113
114     public String getPreSharedKey() {
115         return preSharedKey;
116     }
117
118     public void setPreSharedKey(String preSharedKey) {
119         this.preSharedKey = preSharedKey;
120     }
121
122     public String getInitiator() {
123         return initiator;
124     }
125
126     public void setInitiator(String initiator) {
127         this.initiator = initiator;
128     }
129
130     public String getIkePolicyID() {
131         return ikePolicyID;
132     }
133
134     public void setIkePolicyID(String ikePolicyID) {
135         this.ikePolicyID = ikePolicyID;
136     }
137
138     public String getIpsecPolicyID() {
139         return ipsecPolicyID;
140     }
141
142     public void setIpsecPolicyID(String ipsecPolicyID) {
143         this.ipsecPolicyID = ipsecPolicyID;
144     }
145
146     public String getVpnServiceID() {
147         return vpnServiceID;
148     }
149
150     public void setVpnServiceID(String vpnServiceID) {
151         this.vpnServiceID = vpnServiceID;
152     }
153
154     public NeutronVpnDeadPeerDetection getDeadPeerDetection() {
155         return deadPeerDetection;
156     }
157
158     public void setDeadPeerDetection(NeutronVpnDeadPeerDetection deadPeerDetection) {
159         this.deadPeerDetection = deadPeerDetection;
160     }
161
162     /**
163      * This method copies selected fields from the object and returns them as a
164      * new object, suitable for marshaling.
165      *
166      * @param fields
167      *            List of attributes to be extracted
168      * @return a NeutronVpnIpSecSiteConnection object with only the selected
169      *         fields populated
170      */
171
172     public NeutronVpnIpSecSiteConnection extractFields(List<String> fields) {
173         NeutronVpnIpSecSiteConnection ans = new NeutronVpnIpSecSiteConnection();
174         for (String s : fields) {
175             extractField(s, ans);
176             if (s.equals("peer_address")) {
177                 ans.setPeerAddress(this.getPeerAddress());
178             }
179             if (s.equals("peer_id")) {
180                 ans.setPeerID(this.getPeerID());
181             }
182             if (s.equals("route_mode")) {
183                 ans.setRouteMode(this.getRouteMode());
184             }
185             if (s.equals("mtu")) {
186                 ans.setMtu(this.getMtu());
187             }
188             if (s.equals("auth_mode")) {
189                 ans.setAuthMode(this.getAuthMode());
190             }
191             if (s.equals("psk")) {
192                 ans.setPreSharedKey(this.getPreSharedKey());
193             }
194             if (s.equals("initiator")) {
195                 ans.setInitiator(this.getInitiator());
196             }
197             if (s.equals("ikepolicy_id")) {
198                 ans.setIkePolicyID(this.getIkePolicyID());
199             }
200             if (s.equals("ipsecpolicy_id")) {
201                 ans.setIpsecPolicyID(this.getIpsecPolicyID());
202             }
203             if (s.equals("vpnservice_id")) {
204                 ans.setVpnServiceID(this.getVpnServiceID());
205             }
206         }
207         return ans;
208     }
209
210     @Override
211     public String toString() {
212         return "NeutronVpnIpSecSiteConnection{" + "id='" + uuid + '\'' + ", tenantID='" + tenantID + '\'' + ", name='"
213                 + name + '\'' + ", peerAddress=" + peerAddress + ", peerID='" + peerID + '\'' + ", routeMode='"
214                 + routeMode + '\'' + ", mtu=" + mtu + ", authMode='" + authMode + '\'' + ", preSharedKey='"
215                 + preSharedKey + '\'' + ", initiator='" + initiator + '\'' + ", adminStateUp=" + adminStateUp
216                 + ", status='" + status + '\'' + ", ikePolicyID='" + ikePolicyID + '\'' + ", ipsecPolicyID='"
217                 + ipsecPolicyID + '\'' + ", vpnServiceID='" + vpnServiceID + '\'' + '}';
218     }
219 }