Dynamic Cloud Owner Support
[so.git] / bpmn / MSOCommonBPMN / src / main / java / org / onap / so / bpmn / servicedecomposition / tasks / BBInputSetupMapperLayer.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.bpmn.servicedecomposition.tasks;
22
23 import java.util.ArrayList;
24 import java.util.Arrays;
25 import java.util.List;
26 import java.util.Map;
27 import java.util.Optional;
28
29 import org.modelmapper.ModelMapper;
30 import org.modelmapper.convention.MatchingStrategies;
31 import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
32 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
33 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
34 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
35 import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
36 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
37 import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement;
38 import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc;
39 import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc;
40 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
41 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
42 import org.onap.so.bpmn.servicedecomposition.bbobjects.LagInterface;
43 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
44 import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
45 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
46 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
47 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
48 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
49 import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
50 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
51 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
52 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
53 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
54 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
55 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
56 import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
57 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
58 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
59 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
60 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection;
61 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
62 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
63 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
64 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
65 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
66 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
67 import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
68 import org.onap.so.db.catalog.beans.CollectionResource;
69 import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
70 import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
71 import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
72 import org.onap.so.db.catalog.beans.InstanceGroup;
73 import org.onap.so.db.catalog.beans.InstanceGroupType;
74 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
75 import org.onap.so.db.catalog.beans.OrchestrationStatus;
76 import org.onap.so.db.catalog.beans.Service;
77 import org.onap.so.db.catalog.beans.VfModuleCustomization;
78 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
79 import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
80 import org.onap.so.logger.MsoLogger;
81 import org.onap.so.serviceinstancebeans.CloudConfiguration;
82 import org.onap.so.serviceinstancebeans.RequestDetails;
83 import org.springframework.stereotype.Component;
84
85 @Component("BBInputSetupMapperLayer")
86 public class BBInputSetupMapperLayer {
87
88         private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
89                         BBInputSetupMapperLayer.class);
90
91         private ModelMapper modelMapper = new ModelMapper();
92
93         public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) {
94                 return modelMapper.map(customerAAI, Customer.class);
95         }
96
97         public ServiceSubscription mapAAIServiceSubscription(
98                         org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI) {
99                 return modelMapper.map(serviceSubscriptionAAI, ServiceSubscription.class);
100         }
101
102         protected Project mapAAIProject(org.onap.aai.domain.yang.Project aaiProject) {
103                 return modelMapper.map(aaiProject, Project.class);
104         }
105
106         protected OwningEntity mapAAIOwningEntity(org.onap.aai.domain.yang.OwningEntity aaiOwningEntity) {
107                 return modelMapper.map(aaiOwningEntity, OwningEntity.class);
108         }
109
110         protected Platform mapAAIPlatform(org.onap.aai.domain.yang.Platform aaiPlatform) {
111                 return modelMapper.map(aaiPlatform, Platform.class);
112         }
113
114         protected LineOfBusiness mapAAILineOfBusiness(org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness) {
115                 return modelMapper.map(aaiLineOfBusiness, LineOfBusiness.class);
116         }
117
118         protected SegmentationAssignment mapAAISegmentationAssignment(
119                         org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment) {
120                 return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class);
121         }
122
123         protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) {
124                 return modelMapper.map(aaiCtagAssignment, CtagAssignment.class);
125         }
126
127         protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) {
128                 return modelMapper.map(aaiSubnet, Subnet.class);
129         }
130
131         protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) {
132                 return modelMapper.map(aaiLicense, License.class);
133         }
134
135         protected Entitlement mapAAIEntitlement(org.onap.aai.domain.yang.Entitlement aaiEntitlement) {
136                 return modelMapper.map(aaiEntitlement, Entitlement.class);
137         }
138
139         protected LagInterface mapAAILagInterface(org.onap.aai.domain.yang.LagInterface aaiLagInterface) {
140                 return modelMapper.map(aaiLagInterface, LagInterface.class);
141         }
142
143         protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) {
144                 VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class);
145                 vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus()));
146                 
147                 ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
148                 modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule());             
149                 vfModule.setModelInfoVfModule(modelInfoVfModule);               
150                 return vfModule;
151         }
152
153         public NetworkPolicy mapAAINetworkPolicy(org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy) {
154                 return modelMapper.map(aaiNetworkPolicy, NetworkPolicy.class);
155         }
156
157         protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) {
158                 VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class);
159                 volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus()));
160                 return volumeGroup;
161         }
162
163         protected void setPlatformAndLOBIntoServiceInstance(Platform platformMSO, LineOfBusiness lineOfBusinessMSO,
164                         ServiceInstance serviceInstance, Map<ResourceKey, String> resourcesToBeOrchestrated) {
165                 String vnfId = resourcesToBeOrchestrated.get(ResourceKey.GENERIC_VNF_ID);
166                 if (vnfId != null && !serviceInstance.getVnfs().isEmpty()) {
167                         for (GenericVnf vnf : serviceInstance.getVnfs()) {
168                                 if (vnf.getVnfId().equalsIgnoreCase(vnfId)) {
169                                         vnf.setPlatform(platformMSO);
170                                         vnf.setLineOfBusiness(lineOfBusinessMSO);
171                                         break;
172                                 }
173                         }
174                 }
175         }
176
177         public ModelInfoServiceInstance mapCatalogServiceIntoServiceInstance(Service service) {
178                 return modelMapper.map(service, ModelInfoServiceInstance.class);
179         }
180
181         protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) {
182                 ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class);
183                 if(instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK))
184                         modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK);
185                 else
186                         modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC);
187                 if(collectionCust != null) {
188                         List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = instanceGroup.getCollectionInstanceGroupCustomizations();
189                         for(CollectionResourceInstanceGroupCustomization collectionInsatnceGroupCust : instanceGroupCustList) {
190                                 if(collectionInsatnceGroupCust.getModelCustomizationUUID().equalsIgnoreCase(collectionCust.getModelCustomizationUUID())) {
191                                         modelInfoInstanceGroup.setFunction(collectionInsatnceGroupCust.getFunction());
192                                         modelInfoInstanceGroup.setDescription(collectionInsatnceGroupCust.getDescription());
193                                         break;
194                                 }
195                         }
196                 }
197                 return modelInfoInstanceGroup;
198         }
199
200         protected ModelInfoCollection mapCatalogCollectionToCollection(CollectionResourceCustomization collectionCust,
201                         CollectionResource collectionResource) {
202                 ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
203                 modelInfoCollection.setCollectionFunction(collectionCust.getFunction());
204                 modelInfoCollection.setCollectionRole(collectionCust.getRole());
205                 modelInfoCollection.setCollectionType(collectionCust.getType());
206                 modelInfoCollection.setDescription(collectionResource.getDescription());
207                 modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID());
208                 modelInfoCollection.setModelVersionId(collectionResource.getModelUUID());
209                 modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID());
210                 return modelInfoCollection;
211         }
212
213         public ServiceInstance mapAAIServiceInstanceIntoServiceInstance(
214                         org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) {
215                 ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class);
216                 if (aaiServiceInstance.getAllottedResources() != null) {
217                         for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources()
218                                         .getAllottedResource()) {
219                                 serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource));
220                         }
221                 }
222                 serviceInstance.setOrchestrationStatus(
223                                 this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus()));
224                 return serviceInstance;
225         }
226
227         protected AllottedResource mapAAIAllottedResource(org.onap.aai.domain.yang.AllottedResource aaiAllottedResource) {
228                 AllottedResource allottedResource = modelMapper.map(aaiAllottedResource, AllottedResource.class);
229                 return allottedResource;
230         }
231
232         protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) {
233                 L3Network network = modelMapper.map(aaiL3Network, L3Network.class);
234                 mapAllSubnetsIntoL3Network(aaiL3Network, network);
235                 mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network);
236                 mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network);
237                 network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus()));
238                 return network;
239         }
240
241         protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
242                         L3Network network) {
243                 if (aaiL3Network.getSegmentationAssignments() != null) {
244                         for (org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment : aaiL3Network
245                                         .getSegmentationAssignments().getSegmentationAssignment()) {
246                                 network.getSegmentationAssignments().add(mapAAISegmentationAssignment(aaiSegmentationAssignment));
247                         }
248                 }
249         }
250
251         protected void mapAllCtagAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
252                         L3Network network) {
253                 if (aaiL3Network.getCtagAssignments() != null) {
254                         for (org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment : aaiL3Network.getCtagAssignments()
255                                         .getCtagAssignment()) {
256                                 network.getCtagAssignments().add(mapAAICtagAssignment(aaiCtagAssignment));
257                         }
258                 }
259         }
260
261         protected void mapAllSubnetsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) {
262                 if (aaiL3Network.getSubnets() != null) {
263                         for (org.onap.aai.domain.yang.Subnet aaiSubnet : aaiL3Network.getSubnets().getSubnet()) {
264                                 network.getSubnets().add(mapAAISubnet(aaiSubnet));
265                         }
266                 }
267         }
268
269         protected GenericVnf mapAAIGenericVnfIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf) {
270                 GenericVnf genericVnf = modelMapper.map(aaiGenericVnf, GenericVnf.class);
271                 mapAllVfModulesIntoGenericVnf(aaiGenericVnf, genericVnf);
272                 mapAllLagInterfacesIntoGenericVnf(aaiGenericVnf, genericVnf);
273                 mapAllEntitlementsIntoGenericVnf(aaiGenericVnf, genericVnf);
274                 mapAllLicensesIntoGenericVnf(aaiGenericVnf, genericVnf);
275                 genericVnf.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiGenericVnf.getOrchestrationStatus()));
276                 return genericVnf;
277         }
278
279         protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
280                         GenericVnf genericVnf) {
281                 if (aaiGenericVnf.getLicenses() != null) {
282                         for (org.onap.aai.domain.yang.License aaiLicense : aaiGenericVnf.getLicenses().getLicense()) {
283                                 genericVnf.setLicense(mapAAILicense(aaiLicense));
284                         }
285                 }
286         }
287
288         protected void mapAllEntitlementsIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
289                         GenericVnf genericVnf) {
290                 if (aaiGenericVnf.getEntitlements() != null) {
291                         for (org.onap.aai.domain.yang.Entitlement aaiEntitlement : aaiGenericVnf.getEntitlements()
292                                         .getEntitlement()) {
293                                 genericVnf.getEntitlements().add(mapAAIEntitlement(aaiEntitlement));
294                         }
295                 }
296         }
297
298         protected void mapAllLagInterfacesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
299                         GenericVnf genericVnf) {
300                 if (aaiGenericVnf.getLagInterfaces() != null) {
301                         for (org.onap.aai.domain.yang.LagInterface aaiLagInterface : aaiGenericVnf.getLagInterfaces()
302                                         .getLagInterface()) {
303                                 genericVnf.getLagInterfaces().add(mapAAILagInterface(aaiLagInterface));
304                         }
305                 }
306         }
307
308         protected void mapAllVfModulesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
309                         GenericVnf genericVnf) {
310                 if (aaiGenericVnf.getVfModules() != null) {
311                         for (org.onap.aai.domain.yang.VfModule aaiVfModule : aaiGenericVnf.getVfModules().getVfModule()) {
312                                 VfModule vfModule = mapAAIVfModule(aaiVfModule);
313                                 genericVnf.getVfModules().add(vfModule);
314                         }
315                 }
316         }
317
318         public OrchestrationStatus mapOrchestrationStatusFromAAI(String orchestrationStatus) {
319
320                 Optional<OrchestrationStatus> result = Arrays.asList(OrchestrationStatus.values()).stream()
321                 .filter(item -> item.fuzzyMap(orchestrationStatus))
322                 .findFirst();
323
324                 return result.orElse(null);
325
326         }
327
328         public RequestContext mapRequestContext(RequestDetails requestDetails) {
329                 RequestContext context = new RequestContext();
330                 modelMapper.map(requestDetails.getRequestInfo(), context);
331                 org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters();
332                 if (null != requestParameters) {
333                         context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
334                         context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters()));
335                 }
336                 return context;
337         }
338
339         protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
340                 RequestParameters requestParams = new RequestParameters();
341                 requestParams.setaLaCarte(requestParameters.getALaCarte());
342                 requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
343                 requestParams.setUserParams(requestParameters.getUserParams());
344                 requestParams.setPayload(requestParameters.getPayload());
345                 return requestParams;
346         }
347
348         protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) {
349                 OrchestrationContext context = new OrchestrationContext();
350                 context.setIsRollbackEnabled((requestDetails.getRequestInfo().getSuppressRollback()));
351                 return context;
352         }
353
354         protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) {
355                 CloudRegion cloudRegion = new CloudRegion();
356                 if(cloudConfiguration != null)
357                         cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class);
358                 if(aaiCloudRegion != null)
359                         modelMapper.map(aaiCloudRegion, cloudRegion);
360                 return cloudRegion;
361         }
362
363         protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) {
364                 Collection collection = new Collection();
365                 collection.setId(aaiCollection.getCollectionId());
366                 collection.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiCollection.getOrchestrationStatus()));
367                 return collection;
368         }
369
370         protected org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup mapAAIInstanceGroupIntoInstanceGroup(
371                         org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup) {
372                 return modelMapper.map(aaiInstanceGroup,
373                                 org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class);
374         }
375
376         public RouteTableReference mapAAIRouteTableReferenceIntoRouteTableReference(
377                         org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference) {
378                 return modelMapper.map(aaiRouteTableReference, RouteTableReference.class);
379         }
380
381         protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) {
382                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
383                 ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class);
384                 modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork);
385                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
386                 return modelInfoNetwork;
387         }
388
389         protected ModelInfoGenericVnf mapCatalogVnfToVnf(VnfResourceCustomization vnfResourceCustomization) {
390                 ModelInfoGenericVnf modelInfoVnf = modelMapper.map(vnfResourceCustomization, ModelInfoGenericVnf.class);
391                 modelMapper.map(vnfResourceCustomization.getVnfResources(), modelInfoVnf);
392                 return modelInfoVnf;
393         }
394
395         protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) {
396                 ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class);
397                 modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule);
398                 return modelInfoVfModule;
399         }
400
401         protected Platform mapRequestPlatform(org.onap.so.serviceinstancebeans.Platform platform) {
402                 return modelMapper.map(platform, Platform.class);
403         }
404
405         protected LineOfBusiness mapRequestLineOfBusiness(
406                         org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness) {
407                 return modelMapper.map(lineOfBusiness, LineOfBusiness.class);
408         }
409
410         public Configuration mapAAIConfiguration(org.onap.aai.domain.yang.Configuration configurationAAI) {
411                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
412                 Configuration configuration = modelMapper.map(configurationAAI, Configuration.class);
413                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
414                 configuration.getForwarderEvcs().addAll(mapAllForwarderEvcs(configurationAAI));
415                 configuration.getEvcs().addAll(mapAllEvcs(configurationAAI));
416                 configuration.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(configurationAAI.getOrchestrationStatus()));
417                 return configuration;
418         }
419
420         protected List<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
421                 List<Evc> listOfEvcs = new ArrayList<>();
422                 if (configurationAAI.getEvcs() != null) {
423                         for (org.onap.aai.domain.yang.Evc aaiEvc : configurationAAI.getEvcs().getEvc()) {
424                                 listOfEvcs.add(mapEvc(aaiEvc));
425                         }
426                 }
427                 return listOfEvcs;
428         }
429
430         protected Evc mapEvc(org.onap.aai.domain.yang.Evc aaiEvc) {
431                 return modelMapper.map(aaiEvc, Evc.class);
432         }
433
434         protected List<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
435                 List<ForwarderEvc> listOfForwarderEvcs = new ArrayList<>();
436                 if (configurationAAI.getForwarderEvcs() != null) {
437                         for (org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc : configurationAAI.getForwarderEvcs().getForwarderEvc()) {
438                                 listOfForwarderEvcs.add(mapForwarderEvc(aaiForwarderEvc));
439                         }
440                 }
441                 return listOfForwarderEvcs;
442         }
443
444         protected ForwarderEvc mapForwarderEvc(org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc) {
445                 return modelMapper.map(aaiForwarderEvc, ForwarderEvc.class);
446         }
447
448         protected OwningEntity mapRequestOwningEntity(org.onap.so.serviceinstancebeans.OwningEntity owningEntity) {
449                 return modelMapper.map(owningEntity, OwningEntity.class);
450         }
451
452         protected Project mapRequestProject(org.onap.so.serviceinstancebeans.Project project) {
453                 return modelMapper.map(project, Project.class);
454         }
455
456         protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
457                         ConfigurationResourceCustomization configurationResourceCustomization, 
458                         VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) {
459                 ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
460                 modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
461                 modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
462                 modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
463                 modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
464                 return modelInfoConfiguration;
465         }
466
467         public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust(
468                         CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
469                 return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
470         }
471 }