5d963134b2fff794095e8c4ebc2b80741a5a59f7
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / serviceInstantiation / ServiceInstantiation.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 2019 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.vid.model.serviceInstantiation;
22
23 import com.fasterxml.jackson.annotation.JsonProperty;
24 import org.onap.vid.job.JobAdapter;
25 import org.onap.vid.mso.model.ModelInfo;
26
27 import java.util.Collections;
28 import java.util.List;
29 import java.util.Map;
30
31 public class ServiceInstantiation extends BaseResource implements JobAdapter.AsyncJobRequest {
32
33     private final String owningEntityId;
34
35     private final String owningEntityName;
36
37     private final String projectName;
38
39     private final String subscriberName;
40
41     private final String globalSubscriberId;
42
43     private final String productFamilyId;
44
45     private final String subscriptionServiceType;
46
47     private final String tenantName;
48
49     private final String aicZoneId;
50
51     private final String aicZoneName;
52
53     private final Map<String, Vnf> vnfs;
54
55     private final Map<String, Network> networks;
56
57     private final Map<String, InstanceGroup> vnfGroups;
58
59     private final boolean isPause;
60
61     private final int bulkSize;
62
63     private final String testApi;
64
65     private final boolean isALaCarte;
66
67     public ServiceInstantiation(@JsonProperty("modelInfo") ModelInfo modelInfo,
68                                 @JsonProperty("owningEntityId") String owningEntityId,
69                                 @JsonProperty("owningEntityName") String owningEntityName,
70                                 @JsonProperty("projectName") String projectName,
71                                 @JsonProperty("globalSubscriberId") String globalSubscriberId,
72                                 @JsonProperty("subscriberName") String subscriberName,
73                                 @JsonProperty("productFamilyId") String productFamilyId,
74                                 @JsonProperty("instanceName") String instanceName,
75                                 @JsonProperty("subscriptionServiceType") String subscriptionServiceType,
76                                 @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
77                                 @JsonProperty("legacyRegion") String legacyRegion,
78                                 @JsonProperty("tenantId") String tenantId,
79                                 @JsonProperty("tenantName") String tenantName,
80                                 @JsonProperty("aicZoneId") String aicZoneId,
81                                 @JsonProperty("aicZoneName") String aicZoneName,
82                                 @JsonProperty("vnfs") Map<String, Vnf> vnfs,
83                                 @JsonProperty("networks") Map<String, Network> networks,
84                                 @JsonProperty("vnfGroups") Map<String, InstanceGroup> vnfGroups,
85                                 @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
86                                 @JsonProperty("pause") boolean isPause,
87                                 @JsonProperty("bulkSize") int bulkSize,
88                                 @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
89                                 @JsonProperty("isALaCarte") boolean isALaCarte,
90                                 @JsonProperty("testApi") String testApi,
91                                 @JsonProperty("instanceId") String instanceId,
92                                 @JsonProperty("action") String action
93                                ) {
94         super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId);
95         this.owningEntityId = owningEntityId;
96         this.owningEntityName = owningEntityName;
97         this.projectName = projectName;
98         this.globalSubscriberId = globalSubscriberId;
99         this.subscriberName = subscriberName;
100         this.productFamilyId = productFamilyId;
101         this.subscriptionServiceType = subscriptionServiceType;
102         this.tenantName = tenantName;
103         this.aicZoneId = aicZoneId;
104         this.aicZoneName = aicZoneName;
105         this.vnfs = vnfs;
106         this.networks = networks;
107         this.vnfGroups = vnfGroups;
108         this.isPause = isPause;
109         this.bulkSize = bulkSize;
110         this.isALaCarte = isALaCarte;
111         this.testApi = isALaCarte ? testApi : null;
112     }
113
114     public String getOwningEntityId() {
115         return owningEntityId;
116     }
117
118     public String getOwningEntityName() {
119         return owningEntityName;
120     }
121
122     public String getProjectName() {
123         return projectName;
124     }
125
126     public String getGlobalSubscriberId() {
127         return globalSubscriberId;
128     }
129
130     public String getSubscriberName() {
131         return subscriberName;
132     }
133
134     public String getProductFamilyId() {
135         return productFamilyId;
136     }
137
138     public String getSubscriptionServiceType() {
139         return subscriptionServiceType;
140     }
141
142     public String getTenantName() {
143         return tenantName;
144     }
145
146     public String getAicZoneId() {
147         return aicZoneId;
148     }
149
150     public String getAicZoneName() {
151         return aicZoneName;
152     }
153
154     public Map<String, Vnf> getVnfs() {
155         return vnfs == null ? Collections.emptyMap() : vnfs;
156     }
157
158     public Map<String, Network> getNetworks() {
159         return networks == null ? Collections.emptyMap() : networks;
160     }
161
162     public Map<String, InstanceGroup> getVnfGroups() {
163         return vnfGroups == null ? Collections.emptyMap() : vnfGroups;
164     }
165
166     public boolean isPause() {
167         return isPause;
168     }
169
170     public int getBulkSize() { return bulkSize; }
171
172     @Override
173     protected String getModelType() {
174         return "service";
175     }
176
177     @JsonProperty("isALaCarte")
178     public boolean isALaCarte() {
179         return isALaCarte;
180     }
181
182     public String getTestApi() {
183         return this.testApi;
184     }
185
186 }