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