Initial OpenECOMP MSO commit
[so.git] / adapters / mso-adapters-rest-interface / src / main / java / org / openecomp / mso / adapters / nwrest / CreateNetworkRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - MSO
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 NetworkTechnology networkTechnology = NetworkTechnology.NEUTRON;
64         private List<Subnet> subnets;
65         private ProviderVlanNetwork providerVlanNetwork;
66         private ContrailNetwork contrailNetwork;
67         private Boolean failIfExists = false;
68         private Boolean backout = true;
69         private Map<String,String> networkParams = new HashMap<String, String>();
70         private MsoRequest msoRequest = new MsoRequest();
71
72         public CreateNetworkRequest() {
73                 super();
74         }
75
76         public String getCloudSiteId() {
77                 return cloudSiteId;
78         }
79
80         public void setCloudSiteId(String cloudSiteId) {
81                 this.cloudSiteId = cloudSiteId;
82         }
83
84         public String getTenantId() {
85                 return tenantId;
86         }
87
88         public void setTenantId(String tenantId) {
89                 this.tenantId = tenantId;
90         }
91
92         public String getNetworkId() {
93                 return networkId;
94         }
95
96         public void setNetworkId(String networkId) {
97                 this.networkId = networkId;
98         }
99
100         public String getNetworkName() {
101                 return networkName;
102         }
103
104         public void setNetworkName(String networkName) {
105                 this.networkName = networkName;
106         }
107
108         public String getNetworkType() {
109                 return networkType;
110         }
111
112         public void setNetworkType(String networkType) {
113                 this.networkType = networkType;
114         }
115
116         public String getNetworkTypeVersion() {
117                 return networkTypeVersion;
118         }
119
120         public void setNetworkTypeVersion(String networkTypeVersion) {
121                 this.networkTypeVersion = networkTypeVersion;
122         }
123
124         public String getNetworkTechnology() {
125                 return networkTechnology.toString();
126         }
127
128         public void setNetworkTechnology(String networkTechnology) {
129                 this.networkTechnology = NetworkTechnology.valueOf(networkTechnology);
130         }
131
132         public List<Subnet> getSubnets() {
133                 return subnets;
134         }
135
136         public void setSubnets(List<Subnet> subnets) {
137                 this.subnets = subnets;
138         }
139
140         public ProviderVlanNetwork getProviderVlanNetwork() {
141                 return providerVlanNetwork;
142         }
143
144         public void setProviderVlanNetwork(ProviderVlanNetwork providerVlanNetwork) {
145                 this.providerVlanNetwork = providerVlanNetwork;
146         }
147
148         public ContrailNetwork getContrailNetwork() {
149                 return contrailNetwork;
150         }
151
152         public void setContrailNetwork(ContrailNetwork contrailNetwork) {
153                 this.contrailNetwork = contrailNetwork;
154         }
155
156         public Boolean getFailIfExists() {
157                 return failIfExists;
158         }
159
160         public void setFailIfExists(Boolean failIfExists) {
161                 this.failIfExists = failIfExists;
162         }
163
164         public Boolean getBackout() {
165                 return backout;
166         }
167
168         public void setBackout(Boolean backout) {
169                 this.backout = backout;
170         }
171
172         public Map<String, String> getNetworkParams() {
173                 return networkParams;
174         }
175
176         public void setNetworkParams(Map<String, String> networkParams) {
177                 this.networkParams = networkParams;
178         }
179
180         public MsoRequest getMsoRequest() {
181                 return msoRequest;
182         }
183
184         public void setMsoRequest(MsoRequest msoRequest) {
185                 this.msoRequest = msoRequest;
186         }
187
188         public boolean isContrailRequest() {
189                 return (networkTechnology == NetworkTechnology.CONTRAIL) && (contrailNetwork != null);
190         }
191 }