739ccb2a4ccfadea91ad26d900faef5e04ee41a2
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronVpnIpSecPolicy.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 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22 public final class NeutronVpnIpSecPolicy extends NeutronBaseAttributes<NeutronVpnIpSecPolicy> implements Serializable {
23     private static final Logger LOGGER = LoggerFactory.getLogger(NeutronVpnIpSecPolicy.class);
24     private static final long serialVersionUID = 1L;
25
26     // See OpenStack Network API v2.0 Reference for description of
27     // annotated attributes
28
29     @XmlElement(name = "transform_protocol")
30     String transformProtocol;
31
32     @XmlElement(name = "encapsulation_mode")
33     String encapsulationMode;
34
35     @XmlElement(name = "auth_algorithm")
36     String authAlgorithm;
37
38     @XmlElement(name = "encryption_algorithm")
39     String encryptionAlgorithm;
40
41     @XmlElement(name = "pfs")
42     String perfectForwardSecrecy;
43
44     @XmlElement(name = "lifetime")
45     NeutronVpnLifetime lifetime;
46
47     public NeutronVpnIpSecPolicy() {
48     }
49
50     public String getTransformProtocol() {
51         return transformProtocol;
52     }
53
54     public void setTransformProtocol(String transformProtocol) {
55         this.transformProtocol = transformProtocol;
56     }
57
58     public String getEncapsulationMode() {
59         return encapsulationMode;
60     }
61
62     public void setEncapsulationMode(String encapsulationMode) {
63         this.encapsulationMode = encapsulationMode;
64     }
65
66     public String getAuthAlgorithm() {
67         return authAlgorithm;
68     }
69
70     public void setAuthAlgorithm(String authAlgorithm) {
71         this.authAlgorithm = authAlgorithm;
72     }
73
74     public String getEncryptionAlgorithm() {
75         return encryptionAlgorithm;
76     }
77
78     public void setEncryptionAlgorithm(String encryptionAlgorithm) {
79         this.encryptionAlgorithm = encryptionAlgorithm;
80     }
81
82     public String getPerfectForwardSecrecy() {
83         return perfectForwardSecrecy;
84     }
85
86     public void setPerfectForwardSecrecy(String perfectForwardSecrecy) {
87         this.perfectForwardSecrecy = perfectForwardSecrecy;
88     }
89
90     public NeutronVpnLifetime getLifetime() {
91         return lifetime;
92     }
93
94     public void setLifetime(NeutronVpnLifetime lifetime) {
95         this.lifetime = lifetime;
96     }
97
98     /**
99      * This method copies selected fields from the object and returns them
100      * as a new object, suitable for marshaling.
101      *
102      * @param fields
103      *            List of attributes to be extracted
104      * @return a NeutronVpnIpSecPolicy object with only the selected fields
105      *             populated
106      */
107     public NeutronVpnIpSecPolicy extractFields(List<String> fields) {
108         NeutronVpnIpSecPolicy ans = new NeutronVpnIpSecPolicy();
109         for (String s : fields) {
110             if (extractField(s, ans)) {
111                 continue;
112             }
113             switch (s) {
114                 case "transform_protocol":
115                     ans.setTransformProtocol(this.getTransformProtocol());
116                     break;
117                 case "encapsulation_mode":
118                     ans.setEncapsulationMode(this.getEncapsulationMode());
119                     break;
120                 case "auth_algorithm":
121                     ans.setAuthAlgorithm(this.getAuthAlgorithm());
122                     break;
123                 case "encryption_algorithm":
124                     ans.setEncryptionAlgorithm(this.getEncryptionAlgorithm());
125                     break;
126                 case "pfs":
127                     ans.setPerfectForwardSecrecy(this.getPerfectForwardSecrecy());
128                     break;
129                 default:
130                     LOGGER.warn("{} is not an NeutronVpnIpSecPolicy suitable field.", s);
131                     break;
132             }
133         }
134         return ans;
135     }
136
137 }