Change the header to SO
[so.git] / adapters / mso-adapters-rest-interface / src / main / java / org / openecomp / mso / adapters / nwrest / CreateNetworkRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.mso.adapters.nwrest;
22
23
24
25 import org.openecomp.mso.openstack.beans.Subnet;
26 import org.openecomp.mso.entity.MsoRequest;
27
28 import java.util.List;
29 import java.util.Map;
30 import java.util.HashMap;
31
32 import javax.xml.bind.annotation.XmlRootElement;
33
34 import org.jboss.resteasy.annotations.providers.NoJackson;
35
36 import org.codehaus.jackson.map.annotate.JsonRootName;
37
38 /* README
39 * 1) Used JAXB/Jettison - see @NoJackson annotation on class to get RootElements REad by RestEasy
40 * 2) due to 1) Maps need to use this format
41
42 "networkParams": {"entry": [
43                                 {"key": "network_id",
44                                 "value": "59ed7b41-2983-413f-ba93-e7d437433916"},
45                                 {"key": "subnet_id",
46                                 "value": "086c9298-5c57-49b7-bb2b-6fd5730c5d92"},
47                                 {"key": "server_name_0",
48                                 "value": "RaaNetwork1"}
49                                 ]},
50  * 3) to output json see toJSonString method below which required the @JsonRootName annotation and the WRAP_ROOT feature enabled
51  * 4) Tryong to work with RESTEASY JACKSON and JAXB/JETTISON to conform to Json input/output specs
52 */
53 @JsonRootName("createNetworkRequest")
54 @XmlRootElement(name = "createNetworkRequest")
55 @NoJackson
56 public class CreateNetworkRequest extends NetworkRequestCommon {
57         private String cloudSiteId;
58         private String tenantId;
59         private String networkId;
60         private String networkName;
61         private String networkType;
62         private String networkTypeVersion;
63         private String modelCustomizationUuid;
64         private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON;
65         private List<Subnet> subnets;
66         private ProviderVlanNetwork providerVlanNetwork;
67         private ContrailNetwork contrailNetwork;
68         private Boolean failIfExists = false;
69         private Boolean backout = true;
70         private Map<String,String> networkParams = new HashMap<String, String>();
71         private MsoRequest msoRequest = new MsoRequest();
72
73         public CreateNetworkRequest() {
74                 super();
75         }
76
77         public String getCloudSiteId() {
78                 return cloudSiteId;
79         }
80
81         public void setCloudSiteId(String cloudSiteId) {
82                 this.cloudSiteId = cloudSiteId;
83         }
84
85         public String getTenantId() {
86                 return tenantId;
87         }
88
89         public void setTenantId(String tenantId) {
90                 this.tenantId = tenantId;
91         }
92
93         public String getNetworkId() {
94                 return networkId;
95         }
96
97         public void setNetworkId(String networkId) {
98                 this.networkId = networkId;
99         }
100
101         public String getNetworkName() {
102                 return networkName;
103         }
104
105         public void setNetworkName(String networkName) {
106                 this.networkName = networkName;
107         }
108
109         public String getNetworkType() {
110                 return networkType;
111         }
112
113         public void setNetworkType(String networkType) {
114                 this.networkType = networkType;
115         }
116
117         public String getModelCustomizationUuid() {
118                 return this.modelCustomizationUuid;
119         }
120
121         public void setModelCustomizationUuid(String modelCustomizationUuid) {
122                 this.modelCustomizationUuid = modelCustomizationUuid;
123         }
124
125         public String getNetworkTypeVersion() {
126                 return networkTypeVersion;
127         }
128
129         public void setNetworkTypeVersion(String networkTypeVersion) {
130                 this.networkTypeVersion = networkTypeVersion;
131         }
132
133         public String getNetworkTechnology() {
134                 return networkTechnology.toString();
135         }
136
137         public void setNetworkTechnology(String networkTechnology) {
138                 this.networkTechnology = NetworkTechnology.valueOf(networkTechnology);
139         }
140
141         public List<Subnet> getSubnets() {
142                 return subnets;
143         }
144
145         public void setSubnets(List<Subnet> subnets) {
146                 this.subnets = subnets;
147         }
148
149         public ProviderVlanNetwork getProviderVlanNetwork() {
150                 return providerVlanNetwork;
151         }
152
153         public void setProviderVlanNetwork(ProviderVlanNetwork providerVlanNetwork) {
154                 this.providerVlanNetwork = providerVlanNetwork;
155         }
156
157         public ContrailNetwork getContrailNetwork() {
158                 return contrailNetwork;
159         }
160
161         public void setContrailNetwork(ContrailNetwork contrailNetwork) {
162                 this.contrailNetwork = contrailNetwork;
163         }
164
165         public Boolean getFailIfExists() {
166                 return failIfExists;
167         }
168
169         public void setFailIfExists(Boolean failIfExists) {
170                 this.failIfExists = failIfExists;
171         }
172
173         public Boolean getBackout() {
174                 return backout;
175         }
176
177         public void setBackout(Boolean backout) {
178                 this.backout = backout;
179         }
180
181         public Map<String, String> getNetworkParams() {
182                 return networkParams;
183         }
184
185         public void setNetworkParams(Map<String, String> networkParams) {
186                 this.networkParams = networkParams;
187         }
188
189         public MsoRequest getMsoRequest() {
190                 return msoRequest;
191         }
192
193         public void setMsoRequest(MsoRequest msoRequest) {
194                 this.msoRequest = msoRequest;
195         }
196
197         public boolean isContrailRequest() {
198                 return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null);
199         }
200 }