added generic fabric support to SO
[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                 return requestParams;
345         }
346
347         protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) {
348                 OrchestrationContext context = new OrchestrationContext();
349                 context.setIsRollbackEnabled((requestDetails.getRequestInfo().getSuppressRollback()));
350                 return context;
351         }
352
353         protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion, String cloudOwner) {
354                 CloudRegion cloudRegion = new CloudRegion();
355                 if(cloudConfiguration != null)
356                         cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class);
357                 if(aaiCloudRegion != null)
358                         modelMapper.map(aaiCloudRegion, cloudRegion);
359                 if(cloudOwner != null)
360                         cloudRegion.setCloudOwner(cloudOwner);
361                 return cloudRegion;
362         }
363
364         protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) {
365                 Collection collection = new Collection();
366                 collection.setId(aaiCollection.getCollectionId());
367                 collection.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiCollection.getOrchestrationStatus()));
368                 return collection;
369         }
370
371         protected org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup mapAAIInstanceGroupIntoInstanceGroup(
372                         org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup) {
373                 return modelMapper.map(aaiInstanceGroup,
374                                 org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class);
375         }
376
377         public RouteTableReference mapAAIRouteTableReferenceIntoRouteTableReference(
378                         org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference) {
379                 return modelMapper.map(aaiRouteTableReference, RouteTableReference.class);
380         }
381
382         protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) {
383                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
384                 ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class);
385                 modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork);
386                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
387                 return modelInfoNetwork;
388         }
389
390         protected ModelInfoGenericVnf mapCatalogVnfToVnf(VnfResourceCustomization vnfResourceCustomization) {
391                 ModelInfoGenericVnf modelInfoVnf = modelMapper.map(vnfResourceCustomization, ModelInfoGenericVnf.class);
392                 modelMapper.map(vnfResourceCustomization.getVnfResources(), modelInfoVnf);
393                 return modelInfoVnf;
394         }
395
396         protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) {
397                 ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class);
398                 modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule);
399                 return modelInfoVfModule;
400         }
401
402         protected Platform mapRequestPlatform(org.onap.so.serviceinstancebeans.Platform platform) {
403                 return modelMapper.map(platform, Platform.class);
404         }
405
406         protected LineOfBusiness mapRequestLineOfBusiness(
407                         org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness) {
408                 return modelMapper.map(lineOfBusiness, LineOfBusiness.class);
409         }
410
411         public Configuration mapAAIConfiguration(org.onap.aai.domain.yang.Configuration configurationAAI) {
412                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
413                 Configuration configuration = modelMapper.map(configurationAAI, Configuration.class);
414                 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
415                 configuration.getForwarderEvcs().addAll(mapAllForwarderEvcs(configurationAAI));
416                 configuration.getEvcs().addAll(mapAllEvcs(configurationAAI));
417                 configuration.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(configurationAAI.getOrchestrationStatus()));
418                 return configuration;
419         }
420
421         protected List<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
422                 List<Evc> listOfEvcs = new ArrayList<>();
423                 if (configurationAAI.getEvcs() != null) {
424                         for (org.onap.aai.domain.yang.Evc aaiEvc : configurationAAI.getEvcs().getEvc()) {
425                                 listOfEvcs.add(mapEvc(aaiEvc));
426                         }
427                 }
428                 return listOfEvcs;
429         }
430
431         protected Evc mapEvc(org.onap.aai.domain.yang.Evc aaiEvc) {
432                 return modelMapper.map(aaiEvc, Evc.class);
433         }
434
435         protected List<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
436                 List<ForwarderEvc> listOfForwarderEvcs = new ArrayList<>();
437                 if (configurationAAI.getForwarderEvcs() != null) {
438                         for (org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc : configurationAAI.getForwarderEvcs().getForwarderEvc()) {
439                                 listOfForwarderEvcs.add(mapForwarderEvc(aaiForwarderEvc));
440                         }
441                 }
442                 return listOfForwarderEvcs;
443         }
444
445         protected ForwarderEvc mapForwarderEvc(org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc) {
446                 return modelMapper.map(aaiForwarderEvc, ForwarderEvc.class);
447         }
448
449         protected OwningEntity mapRequestOwningEntity(org.onap.so.serviceinstancebeans.OwningEntity owningEntity) {
450                 return modelMapper.map(owningEntity, OwningEntity.class);
451         }
452
453         protected Project mapRequestProject(org.onap.so.serviceinstancebeans.Project project) {
454                 return modelMapper.map(project, Project.class);
455         }
456
457         protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
458                         ConfigurationResourceCustomization configurationResourceCustomization, 
459                         VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) {
460                 ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
461                 modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
462                 modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
463                 modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
464                 modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
465                 return modelInfoConfiguration;
466         }
467
468         public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust(
469                         CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
470                 return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
471         }
472 }