Containerization feature of SO
[so.git] / adapters / mso-adapters-rest-interface / src / main / java / org / onap / so / 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.onap.so.adapters.nwrest;
22
23
24
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28
29 import javax.xml.bind.annotation.XmlRootElement;
30
31 import org.onap.so.entity.MsoRequest;
32 import org.onap.so.openstack.beans.Subnet;
33
34 import com.fasterxml.jackson.annotation.JsonIgnore;
35 import com.fasterxml.jackson.annotation.JsonProperty;
36 import com.fasterxml.jackson.annotation.JsonRootName;
37
38
39 /* README
40  Map<String, String> elements when marshalled to XML produce a list of <entry><key>${MsoUtils.xmlEscape(key)}</key><value>${MsoUtils.xmlEscape(value)}</value></entry> elements.
41  When marshalling to JSON they create a list of "${key}" : "${value}" pairs with no extra wrappers.
42 */
43 @JsonRootName("createNetworkRequest")
44 @XmlRootElement(name = "createNetworkRequest")
45 public class CreateNetworkRequest extends NetworkRequestCommon {
46         /**
47          * 
48          */
49         private static final long serialVersionUID = -8984362978831333521L;
50         private String cloudSiteId;
51         private String tenantId;
52         private String networkId;
53         private String networkName;
54         private String networkType;
55         private String networkTypeVersion;
56         private String modelCustomizationUuid;
57         private NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON;
58         private List<Subnet> subnets;
59         private ProviderVlanNetwork providerVlanNetwork;
60         private ContrailNetwork contrailNetwork;
61         private Boolean failIfExists = false;
62         private Boolean backout = true;
63         private Map<String,String> networkParams = new HashMap<>();
64         private MsoRequest msoRequest = new MsoRequest();
65         @JsonProperty
66         private boolean contrailRequest;
67
68         public CreateNetworkRequest() {
69                 super();
70         }
71
72         public String getCloudSiteId() {
73                 return cloudSiteId;
74         }
75
76         public void setCloudSiteId(String cloudSiteId) {
77                 this.cloudSiteId = cloudSiteId;
78         }
79
80         public String getTenantId() {
81                 return tenantId;
82         }
83
84         public void setTenantId(String tenantId) {
85                 this.tenantId = tenantId;
86         }
87
88         public String getNetworkId() {
89                 return networkId;
90         }
91
92         public void setNetworkId(String networkId) {
93                 this.networkId = networkId;
94         }
95
96         public String getNetworkName() {
97                 return networkName;
98         }
99
100         public void setNetworkName(String networkName) {
101                 this.networkName = networkName;
102         }
103
104         public String getNetworkType() {
105                 return networkType;
106         }
107
108         public void setNetworkType(String networkType) {
109                 this.networkType = networkType;
110         }
111
112         public String getModelCustomizationUuid() {
113                 return this.modelCustomizationUuid;
114         }
115
116         public void setModelCustomizationUuid(String modelCustomizationUuid) {
117                 this.modelCustomizationUuid = modelCustomizationUuid;
118         }
119
120         public String getNetworkTypeVersion() {
121                 return networkTypeVersion;
122         }
123
124         public void setNetworkTypeVersion(String networkTypeVersion) {
125                 this.networkTypeVersion = networkTypeVersion;
126         }
127
128         public NetworkTechnology getNetworkTechnology() {
129                 return networkTechnology;
130         }
131
132         public void setNetworkTechnology(NetworkTechnology networkTechnology) {
133                 this.networkTechnology = networkTechnology;
134                 this.contrailRequest = determineContrail();
135         }
136
137         public List<Subnet> getSubnets() {
138                 return subnets;
139         }
140
141         public void setSubnets(List<Subnet> subnets) {
142                 this.subnets = subnets;
143         }
144
145         public ProviderVlanNetwork getProviderVlanNetwork() {
146                 return providerVlanNetwork;
147         }
148
149         public void setProviderVlanNetwork(ProviderVlanNetwork providerVlanNetwork) {
150                 this.providerVlanNetwork = providerVlanNetwork;
151         }
152
153         public ContrailNetwork getContrailNetwork() {
154                 return contrailNetwork;
155         }
156
157         public void setContrailNetwork(ContrailNetwork contrailNetwork) {
158                 this.contrailNetwork = contrailNetwork;
159                 this.contrailRequest = determineContrail();
160         }
161
162         public Boolean getFailIfExists() {
163                 return failIfExists;
164         }
165
166         public void setFailIfExists(Boolean failIfExists) {
167                 this.failIfExists = failIfExists;
168         }
169
170         public Boolean getBackout() {
171                 return backout;
172         }
173
174         public void setBackout(Boolean backout) {
175                 this.backout = backout;
176         }
177
178         public Map<String, String> getNetworkParams() {
179                 return networkParams;
180         }
181
182         public void setNetworkParams(Map<String, String> networkParams) {
183                 this.networkParams = networkParams;
184         }
185
186         public MsoRequest getMsoRequest() {
187                 return msoRequest;
188         }
189
190         public void setMsoRequest(MsoRequest msoRequest) {
191                 this.msoRequest = msoRequest;
192         }
193
194         public boolean isContrailRequest() {
195                 return this.contrailRequest;
196         }
197         
198         @JsonIgnore
199         protected void setContrailRequest(boolean contrailRequest) {
200                 this.contrailRequest = contrailRequest;
201         }
202         
203         private boolean determineContrail() {
204                 return (networkTechnology == NetworkTechnology.CONTRAIL && (contrailNetwork != null));
205         }
206 }