c2161a4feeaec8c005493546c496e426d2fbe905
[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.logger.MsoLogger;
80 import org.onap.so.serviceinstancebeans.CloudConfiguration;
81 import org.onap.so.serviceinstancebeans.RequestDetails;
82 import org.springframework.stereotype.Component;
83
84 @Component("BBInputSetupMapperLayer")
85 public class BBInputSetupMapperLayer {
86
87         private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
88                         BBInputSetupMapperLayer.class);
89
90         private ModelMapper modelMapper = new ModelMapper();
91
92         public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) {
93                 return modelMapper.map(customerAAI, Customer.class);
94         }
95
96         public ServiceSubscription mapAAIServiceSubscription(
97                         org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI) {
98                 return modelMapper.map(serviceSubscriptionAAI, ServiceSubscription.class);
99         }
100
101         protected Project mapAAIProject(org.onap.aai.domain.yang.Project aaiProject) {
102                 return modelMapper.map(aaiProject, Project.class);
103         }
104
105         protected OwningEntity mapAAIOwningEntity(org.onap.aai.domain.yang.OwningEntity aaiOwningEntity) {
106                 return modelMapper.map(aaiOwningEntity, OwningEntity.class);
107         }
108
109         protected Platform mapAAIPlatform(org.onap.aai.domain.yang.Platform aaiPlatform) {
110                 return modelMapper.map(aaiPlatform, Platform.class);
111         }
112
113         protected LineOfBusiness mapAAILineOfBusiness(org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness) {
114                 return modelMapper.map(aaiLineOfBusiness, LineOfBusiness.class);
115         }
116
117         protected SegmentationAssignment mapAAISegmentationAssignment(
118                         org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment) {
119                 return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class);
120         }
121
122         protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) {
123                 return modelMapper.map(aaiCtagAssignment, CtagAssignment.class);
124         }
125
126         protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) {
127                 return modelMapper.map(aaiSubnet, Subnet.class);
128         }
129
130         protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) {
131                 return modelMapper.map(aaiLicense, License.class);
132         }
133
134         protected Entitlement mapAAIEntitlement(org.onap.aai.domain.yang.Entitlement aaiEntitlement) {
135                 return modelMapper.map(aaiEntitlement, Entitlement.class);
136         }
137
138         protected LagInterface mapAAILagInterface(org.onap.aai.domain.yang.LagInterface aaiLagInterface) {
139                 return modelMapper.map(aaiLagInterface, LagInterface.class);
140         }
141
142         protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) {
143                 VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class);
144                 vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus()));
145                 
146                 ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
147                 modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule());             
148                 vfModule.setModelInfoVfModule(modelInfoVfModule);               
149                 return vfModule;
150         }
151
152         public NetworkPolicy mapAAINetworkPolicy(org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy) {
153                 return modelMapper.map(aaiNetworkPolicy, NetworkPolicy.class);
154         }
155
156         protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) {
157                 VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class);
158                 volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus()));
159                 return volumeGroup;
160         }
161
162         protected void setPlatformAndLOBIntoServiceInstance(Platform platformMSO, LineOfBusiness lineOfBusinessMSO,
163                         ServiceInstance serviceInstance, Map<ResourceKey, String> resourcesToBeOrchestrated) {
164                 String vnfId = resourcesToBeOrchestrated.get(ResourceKey.GENERIC_VNF_ID);
165                 if (vnfId != null && !serviceInstance.getVnfs().isEmpty()) {
166                         for (GenericVnf vnf : serviceInstance.getVnfs()) {
167                                 if (vnf.getVnfId().equalsIgnoreCase(vnfId)) {
168                                         vnf.setPlatform(platformMSO);
169                                         vnf.setLineOfBusiness(lineOfBusinessMSO);
170                                         break;
171                                 }
172                         }
173                 }
174         }
175
176         public ModelInfoServiceInstance mapCatalogServiceIntoServiceInstance(Service service) {
177                 return modelMapper.map(service, ModelInfoServiceInstance.class);
178         }
179
180         protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) {
181                 ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class);
182                 if(instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK))
183                         modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK);
184                 else
185                         modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC);
186                 if(collectionCust != null) {
187                         List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = instanceGroup.getCollectionInstanceGroupCustomizations();
188                         for(CollectionResourceInstanceGroupCustomization collectionInsatnceGroupCust : instanceGroupCustList) {
189                                 if(collectionInsatnceGroupCust.getModelCustomizationUUID().equalsIgnoreCase(collectionCust.getModelCustomizationUUID())) {
190                                         modelInfoInstanceGroup.setFunction(collectionInsatnceGroupCust.getFunction());
191                                         modelInfoInstanceGroup.setDescription(collectionInsatnceGroupCust.getDescription());
192                                         break;
193                                 }
194                         }
195                 }
196                 return modelInfoInstanceGroup;
197         }
198
199         protected ModelInfoCollection mapCatalogCollectionToCollection(CollectionResourceCustomization collectionCust,
200                         CollectionResource collectionResource) {
201                 ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
202                 modelInfoCollection.setCollectionFunction(collectionCust.getFunction());
203                 modelInfoCollection.setCollectionRole(collectionCust.getRole());
204                 modelInfoCollection.setCollectionType(collectionCust.getType());
205                 modelInfoCollection.setDescription(collectionResource.getDescription());
206                 modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID());
207                 modelInfoCollection.setModelVersionId(collectionResource.getModelUUID());
208                 modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID());
209                 return modelInfoCollection;
210         }
211
212         public ServiceInstance mapAAIServiceInstanceIntoServiceInstance(
213                         org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) {
214                 ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class);
215                 if (aaiServiceInstance.getAllottedResources() != null) {
216                         for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources()
217                                         .getAllottedResource()) {
218                                 serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource));
219                         }
220                 }
221                 serviceInstance.setOrchestrationStatus(
222                                 this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus()));
223                 return serviceInstance;
224         }
225
226         protected AllottedResource mapAAIAllottedResource(org.onap.aai.domain.yang.AllottedResource aaiAllottedResource) {
227                 AllottedResource allottedResource = modelMapper.map(aaiAllottedResource, AllottedResource.class);
228                 return allottedResource;
229         }
230
231         protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) {
232                 L3Network network = modelMapper.map(aaiL3Network, L3Network.class);
233                 mapAllSubnetsIntoL3Network(aaiL3Network, network);
234                 mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network);
235                 mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network);
236                 network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus()));
237                 return network;
238         }
239
240         protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
241                         L3Network network) {
242                 if (aaiL3Network.getSegmentationAssignments() != null) {
243                         for (org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment : aaiL3Network
244                                         .getSegmentationAssignments().getSegmentationAssignment()) {
245                                 network.getSegmentationAssignments().add(mapAAISegmentationAssignment(aaiSegmentationAssignment));
246                         }
247                 }
248         }
249
250         protected void mapAllCtagAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
251                         L3Network network) {
252                 if (aaiL3Network.getCtagAssignments() != null) {
253                         for (org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment : aaiL3Network.getCtagAssignments()
254                                         .getCtagAssignment()) {
255                                 network.getCtagAssignments().add(mapAAICtagAssignment(aaiCtagAssignment));
256                         }
257                 }
258         }
259
260         protected void mapAllSubnetsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) {
261                 if (aaiL3Network.getSubnets() != null) {
262                         for (org.onap.aai.domain.yang.Subnet aaiSubnet : aaiL3Network.getSubnets().getSubnet()) {
263                                 network.getSubnets().add(mapAAISubnet(aaiSubnet));
264                         }
265                 }
266         }
267
268         protected GenericVnf mapAAIGenericVnfIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf) {
269                 GenericVnf genericVnf = modelMapper.map(aaiGenericVnf, GenericVnf.class);
270                 mapAllVfModulesIntoGenericVnf(aaiGenericVnf, genericVnf);
271                 mapAllLagInterfacesIntoGenericVnf(aaiGenericVnf, genericVnf);
272                 mapAllEntitlementsIntoGenericVnf(aaiGenericVnf, genericVnf);
273                 mapAllLicensesIntoGenericVnf(aaiGenericVnf, genericVnf);
274                 genericVnf.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiGenericVnf.getOrchestrationStatus()));
275                 return genericVnf;
276         }
277
278         protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
279                         GenericVnf genericVnf) {
280                 if (aaiGenericVnf.getLicenses() != null) {
281                         for (org.onap.aai.domain.yang.License aaiLicense : aaiGenericVnf.getLicenses().getLicense()) {
282                                 genericVnf.setLicense(mapAAILicense(aaiLicense));
283                         }
284                 }
285         }
286
287         protected void mapAllEntitlementsIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
288                         GenericVnf genericVnf) {
289                 if (aaiGenericVnf.getEntitlements() != null) {
290                         for (org.onap.aai.domain.yang.Entitlement aaiEntitlement : aaiGenericVnf.getEntitlements()
291                                         .getEntitlement()) {
292                                 genericVnf.getEntitlements().add(mapAAIEntitlement(aaiEntitlement));
293                         }
294                 }
295         }
296
297         protected void mapAllLagInterfacesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
298                         GenericVnf genericVnf) {
299                 if (aaiGenericVnf.getLagInterfaces() != null) {
300                         for (org.onap.aai.domain.yang.LagInterface aaiLagInterface : aaiGenericVnf.getLagInterfaces()
301                                         .getLagInterface()) {
302                                 genericVnf.getLagInterfaces().add(mapAAILagInterface(aaiLagInterface));
303                         }
304                 }
305         }
306
307         protected void mapAllVfModulesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
308                         GenericVnf genericVnf) {
309                 if (aaiGenericVnf.getVfModules() != null) {
310                         for (org.onap.aai.domain.yang.VfModule aaiVfModule : aaiGenericVnf.getVfModules().getVfModule()) {
311                                 VfModule vfModule = mapAAIVfModule(aaiVfModule);
312                                 genericVnf.getVfModules().add(vfModule);
313                         }
314                 }
315         }
316
317         public OrchestrationStatus mapOrchestrationStatusFromAAI(String orchestrationStatus) {
318
319                 Optional<OrchestrationStatus> result = Arrays.asList(OrchestrationStatus.values()).stream()
320                 .filter(item -> item.fuzzyMap(orchestrationStatus))
321                 .findFirst();
322
323                 return result.orElse(null);
324
325         }
326
327         public RequestContext mapRequestContext(RequestDetails requestDetails) {
328                 RequestContext context = new RequestContext();
329                 modelMapper.map(requestDetails.getRequestInfo(), context);
330                 org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters();
331                 if (null != requestParameters) {
332                         context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
333                         context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters()));
334                 }
335                 return context;
336         }
337
338         protected RequestParameters mapRequestParameters(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
339                 RequestParameters requestParams = new RequestParameters();
340                 requestParams.setaLaCarte(requestParameters.getALaCarte());
341                 requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
342                 requestParams.setUserParams(requestParameters.getUserParams());
343                 return requestParams;
344         }
345
346         protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) {
347                 OrchestrationContext context = new OrchestrationContext();
348                 context.setIsRollbackEnabled((requestDetails.getRequestInfo().getSuppressRollback()));
349                 return context;
350         }
351
352         protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion, String cloudOwner) {
353                 CloudRegion cloudRegion = new CloudRegion();
354                 if(cloudConfiguration != null)
355                         cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class);
356                 if(aaiCloudRegion != null)
357                         modelMapper.map(aaiCloudRegion, cloudRegion);
358                 if(cloudOwner != null)
359                         cloudRegion.setCloudOwner(cloudOwner);
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                 ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
459                 modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
460                 modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
461                 modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
462                 return modelInfoConfiguration;
463         }
464
465         public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust(
466                         CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
467                 return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
468         }
469 }