2 * ============LICENSE_START=======================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
23 package org.onap.so.bpmn.servicedecomposition.tasks;
25 import java.util.ArrayList;
26 import java.util.Arrays;
27 import java.util.HashMap;
28 import java.util.List;
30 import java.util.Optional;
31 import org.modelmapper.ModelMapper;
32 import org.modelmapper.convention.MatchingStrategies;
33 import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
34 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
35 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
36 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
37 import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment;
38 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
39 import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement;
40 import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc;
41 import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc;
42 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
43 import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
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.Tenant;
57 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
58 import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
59 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
60 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
61 import org.onap.so.bpmn.servicedecomposition.generalobjects.License;
62 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
63 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
64 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
65 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection;
66 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
67 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
68 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
69 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
70 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
71 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
72 import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
73 import org.onap.so.db.catalog.beans.CollectionResource;
74 import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
75 import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
76 import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
77 import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
78 import org.onap.so.db.catalog.beans.InstanceGroup;
79 import org.onap.so.db.catalog.beans.InstanceGroupType;
80 import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
81 import org.onap.so.db.catalog.beans.OrchestrationStatus;
82 import org.onap.so.db.catalog.beans.Service;
83 import org.onap.so.db.catalog.beans.VfModuleCustomization;
84 import org.onap.so.db.catalog.beans.VnfResourceCustomization;
85 import org.onap.so.serviceinstancebeans.CloudConfiguration;
86 import org.onap.so.serviceinstancebeans.RequestDetails;
87 import org.slf4j.Logger;
88 import org.slf4j.LoggerFactory;
89 import org.springframework.stereotype.Component;
91 @Component("BBInputSetupMapperLayer")
92 public class BBInputSetupMapperLayer {
93 private static final String USER_PARAM_NAME_KEY = "name";
94 private static final String USER_PARAM_VALUE_KEY = "value";
96 private static final Logger logger = LoggerFactory.getLogger(BBInputSetupMapperLayer.class);
98 private ModelMapper modelMapper = new ModelMapper();
100 public Customer mapAAICustomer(org.onap.aai.domain.yang.Customer customerAAI) {
101 return modelMapper.map(customerAAI, Customer.class);
104 public ServiceSubscription mapAAIServiceSubscription(
105 org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionAAI) {
106 return modelMapper.map(serviceSubscriptionAAI, ServiceSubscription.class);
109 protected Project mapAAIProject(org.onap.aai.domain.yang.Project aaiProject) {
110 return modelMapper.map(aaiProject, Project.class);
113 protected OwningEntity mapAAIOwningEntity(org.onap.aai.domain.yang.OwningEntity aaiOwningEntity) {
114 return modelMapper.map(aaiOwningEntity, OwningEntity.class);
117 protected Platform mapAAIPlatform(org.onap.aai.domain.yang.Platform aaiPlatform) {
118 return modelMapper.map(aaiPlatform, Platform.class);
121 protected LineOfBusiness mapAAILineOfBusiness(org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness) {
122 return modelMapper.map(aaiLineOfBusiness, LineOfBusiness.class);
125 protected SegmentationAssignment mapAAISegmentationAssignment(
126 org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment) {
127 return modelMapper.map(aaiSegmentationAssignment, SegmentationAssignment.class);
130 protected CtagAssignment mapAAICtagAssignment(org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment) {
131 return modelMapper.map(aaiCtagAssignment, CtagAssignment.class);
134 protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) {
135 Subnet subnet = modelMapper.map(aaiSubnet, Subnet.class);
136 mapAllHostRoutesIntoSubnet(aaiSubnet, subnet);
140 protected void mapAllHostRoutesIntoSubnet(org.onap.aai.domain.yang.Subnet aaiSubnet, Subnet subnet) {
141 if (aaiSubnet.getHostRoutes() != null) {
142 for (org.onap.aai.domain.yang.HostRoute aaiHostRoute : aaiSubnet.getHostRoutes().getHostRoute()) {
143 subnet.getHostRoutes().add(mapAAIHostRoute(aaiHostRoute));
148 protected HostRoute mapAAIHostRoute(org.onap.aai.domain.yang.HostRoute aaiHostRoute) {
149 return modelMapper.map(aaiHostRoute, HostRoute.class);
152 protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) {
153 return modelMapper.map(aaiLicense, License.class);
156 protected Entitlement mapAAIEntitlement(org.onap.aai.domain.yang.Entitlement aaiEntitlement) {
157 return modelMapper.map(aaiEntitlement, Entitlement.class);
160 protected LagInterface mapAAILagInterface(org.onap.aai.domain.yang.LagInterface aaiLagInterface) {
161 return modelMapper.map(aaiLagInterface, LagInterface.class);
164 protected VfModule mapAAIVfModule(org.onap.aai.domain.yang.VfModule aaiVfModule) {
165 VfModule vfModule = modelMapper.map(aaiVfModule, VfModule.class);
166 vfModule.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVfModule.getOrchestrationStatus()));
168 ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
169 modelInfoVfModule.setIsBaseBoolean(aaiVfModule.isIsBaseVfModule());
170 vfModule.setModelInfoVfModule(modelInfoVfModule);
174 public NetworkPolicy mapAAINetworkPolicy(org.onap.aai.domain.yang.NetworkPolicy aaiNetworkPolicy) {
175 return modelMapper.map(aaiNetworkPolicy, NetworkPolicy.class);
178 protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) {
179 VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class);
180 volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus()));
184 protected void setPlatformAndLOBIntoServiceInstance(Platform platformMSO, LineOfBusiness lineOfBusinessMSO,
185 ServiceInstance serviceInstance, Map<ResourceKey, String> resourcesToBeOrchestrated) {
186 String vnfId = resourcesToBeOrchestrated.get(ResourceKey.GENERIC_VNF_ID);
187 if (vnfId != null && !serviceInstance.getVnfs().isEmpty()) {
188 for (GenericVnf vnf : serviceInstance.getVnfs()) {
189 if (vnf.getVnfId().equalsIgnoreCase(vnfId)) {
190 vnf.setPlatform(platformMSO);
191 vnf.setLineOfBusiness(lineOfBusinessMSO);
198 public ModelInfoServiceInstance mapCatalogServiceIntoServiceInstance(Service service) {
199 return modelMapper.map(service, ModelInfoServiceInstance.class);
202 protected ModelInfoInstanceGroup mapCatalogInstanceGroupToInstanceGroup(
203 CollectionResourceCustomization collectionCust, InstanceGroup instanceGroup) {
204 ModelInfoInstanceGroup modelInfoInstanceGroup = modelMapper.map(instanceGroup, ModelInfoInstanceGroup.class);
205 if (instanceGroup.getType() != null && instanceGroup.getType().equals(InstanceGroupType.L3_NETWORK))
206 modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_L3_NETWORK);
208 modelInfoInstanceGroup.setType(ModelInfoInstanceGroup.TYPE_VNFC);
209 if (collectionCust != null) {
210 List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList =
211 instanceGroup.getCollectionInstanceGroupCustomizations();
212 for (CollectionResourceInstanceGroupCustomization collectionInsatnceGroupCust : instanceGroupCustList) {
213 if (collectionInsatnceGroupCust.getModelCustomizationUUID()
214 .equalsIgnoreCase(collectionCust.getModelCustomizationUUID())) {
215 modelInfoInstanceGroup.setFunction(collectionInsatnceGroupCust.getFunction());
216 modelInfoInstanceGroup.setDescription(collectionInsatnceGroupCust.getDescription());
221 return modelInfoInstanceGroup;
224 protected ModelInfoCollection mapCatalogCollectionToCollection(CollectionResourceCustomization collectionCust,
225 CollectionResource collectionResource) {
226 ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
227 modelInfoCollection.setCollectionFunction(collectionCust.getFunction());
228 modelInfoCollection.setCollectionRole(collectionCust.getRole());
229 modelInfoCollection.setCollectionType(collectionCust.getType());
230 modelInfoCollection.setDescription(collectionResource.getDescription());
231 modelInfoCollection.setModelInvariantUUID(collectionResource.getModelInvariantUUID());
232 modelInfoCollection.setModelVersionId(collectionResource.getModelUUID());
233 modelInfoCollection.setModelCustomizationUUID(collectionCust.getModelCustomizationUUID());
234 return modelInfoCollection;
237 public ServiceInstance mapAAIServiceInstanceIntoServiceInstance(
238 org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance) {
239 ServiceInstance serviceInstance = modelMapper.map(aaiServiceInstance, ServiceInstance.class);
240 if (aaiServiceInstance.getAllottedResources() != null) {
241 for (org.onap.aai.domain.yang.AllottedResource allottedResource : aaiServiceInstance.getAllottedResources()
242 .getAllottedResource()) {
243 serviceInstance.getAllottedResources().add(mapAAIAllottedResource(allottedResource));
246 serviceInstance.setOrchestrationStatus(
247 this.mapOrchestrationStatusFromAAI(aaiServiceInstance.getOrchestrationStatus()));
248 return serviceInstance;
251 protected AllottedResource mapAAIAllottedResource(org.onap.aai.domain.yang.AllottedResource aaiAllottedResource) {
252 AllottedResource allottedResource = modelMapper.map(aaiAllottedResource, AllottedResource.class);
253 return allottedResource;
256 protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) {
257 L3Network network = modelMapper.map(aaiL3Network, L3Network.class);
258 mapAllSubnetsIntoL3Network(aaiL3Network, network);
259 mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network);
260 mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network);
261 network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus()));
265 protected void mapAllSegmentationAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
267 if (aaiL3Network.getSegmentationAssignments() != null) {
268 for (org.onap.aai.domain.yang.SegmentationAssignment aaiSegmentationAssignment : aaiL3Network
269 .getSegmentationAssignments().getSegmentationAssignment()) {
270 network.getSegmentationAssignments().add(mapAAISegmentationAssignment(aaiSegmentationAssignment));
275 protected void mapAllCtagAssignmentsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network,
277 if (aaiL3Network.getCtagAssignments() != null) {
278 for (org.onap.aai.domain.yang.CtagAssignment aaiCtagAssignment : aaiL3Network.getCtagAssignments()
279 .getCtagAssignment()) {
280 network.getCtagAssignments().add(mapAAICtagAssignment(aaiCtagAssignment));
285 protected void mapAllSubnetsIntoL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network, L3Network network) {
286 if (aaiL3Network.getSubnets() != null) {
287 for (org.onap.aai.domain.yang.Subnet aaiSubnet : aaiL3Network.getSubnets().getSubnet()) {
288 network.getSubnets().add(mapAAISubnet(aaiSubnet));
293 protected GenericVnf mapAAIGenericVnfIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf) {
294 GenericVnf genericVnf = modelMapper.map(aaiGenericVnf, GenericVnf.class);
295 mapAllVfModulesIntoGenericVnf(aaiGenericVnf, genericVnf);
296 mapAllLagInterfacesIntoGenericVnf(aaiGenericVnf, genericVnf);
297 mapAllEntitlementsIntoGenericVnf(aaiGenericVnf, genericVnf);
298 mapAllLicensesIntoGenericVnf(aaiGenericVnf, genericVnf);
299 genericVnf.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiGenericVnf.getOrchestrationStatus()));
303 protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
304 GenericVnf genericVnf) {
305 if (aaiGenericVnf.getLicenses() != null) {
306 for (org.onap.aai.domain.yang.License aaiLicense : aaiGenericVnf.getLicenses().getLicense()) {
307 genericVnf.setLicense(mapAAILicense(aaiLicense));
312 protected void mapAllEntitlementsIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
313 GenericVnf genericVnf) {
314 if (aaiGenericVnf.getEntitlements() != null) {
315 for (org.onap.aai.domain.yang.Entitlement aaiEntitlement : aaiGenericVnf.getEntitlements()
317 genericVnf.getEntitlements().add(mapAAIEntitlement(aaiEntitlement));
322 protected void mapAllLagInterfacesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
323 GenericVnf genericVnf) {
324 if (aaiGenericVnf.getLagInterfaces() != null) {
325 for (org.onap.aai.domain.yang.LagInterface aaiLagInterface : aaiGenericVnf.getLagInterfaces()
326 .getLagInterface()) {
327 genericVnf.getLagInterfaces().add(mapAAILagInterface(aaiLagInterface));
332 protected void mapAllVfModulesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
333 GenericVnf genericVnf) {
334 if (aaiGenericVnf.getVfModules() != null) {
335 for (org.onap.aai.domain.yang.VfModule aaiVfModule : aaiGenericVnf.getVfModules().getVfModule()) {
336 VfModule vfModule = mapAAIVfModule(aaiVfModule);
337 genericVnf.getVfModules().add(vfModule);
342 public OrchestrationStatus mapOrchestrationStatusFromAAI(String orchestrationStatus) {
344 Optional<OrchestrationStatus> result = Arrays.asList(OrchestrationStatus.values()).stream()
345 .filter(item -> item.fuzzyMap(orchestrationStatus)).findFirst();
347 return result.orElse(null);
351 public RequestContext mapRequestContext(RequestDetails requestDetails) {
352 RequestContext context = new RequestContext();
353 if (null != requestDetails.getRequestInfo()) {
354 modelMapper.map(requestDetails.getRequestInfo(), context);
356 org.onap.so.serviceinstancebeans.RequestParameters requestParameters = requestDetails.getRequestParameters();
357 if (null != requestParameters) {
358 context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
359 context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters()));
360 context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters()));
362 if (requestDetails.getConfigurationParameters() != null) {
363 context.setConfigurationParameters(requestDetails.getConfigurationParameters());
368 protected RequestParameters mapRequestParameters(
369 org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
370 RequestParameters requestParams = new RequestParameters();
371 requestParams.setaLaCarte(requestParameters.getALaCarte());
372 requestParams.setUsePreload(requestParameters.getUsePreload());
373 requestParams.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
374 requestParams.setUserParams(requestParameters.getUserParams());
375 requestParams.setPayload(requestParameters.getPayload());
376 return requestParams;
379 protected Map<String, Object> mapNameValueUserParams(
380 org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {
381 Map<String, Object> userParamsResult = new HashMap<String, Object>();
382 if (requestParameters.getUserParams() != null) {
383 List<Map<String, Object>> userParams = requestParameters.getUserParams();
384 for (Map<String, Object> userParamsMap : userParams) {
385 if (userParamsMap.containsKey(USER_PARAM_NAME_KEY)
386 && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String)
387 && userParamsMap.containsKey(USER_PARAM_VALUE_KEY)) {
388 userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY),
389 userParamsMap.get(USER_PARAM_VALUE_KEY));
393 return userParamsResult;
396 protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) {
397 OrchestrationContext context = new OrchestrationContext();
398 if (requestDetails.getRequestInfo() != null) {
399 context.setIsRollbackEnabled(!(requestDetails.getRequestInfo().getSuppressRollback()));
401 context.setIsRollbackEnabled(false);
406 protected CloudRegion mapCloudRegion(CloudConfiguration cloudConfiguration,
407 org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) {
408 CloudRegion cloudRegion = new CloudRegion();
409 if (cloudConfiguration != null)
410 cloudRegion = modelMapper.map(cloudConfiguration, CloudRegion.class);
411 if (aaiCloudRegion != null)
412 modelMapper.map(aaiCloudRegion, cloudRegion);
416 protected Tenant mapTenant(org.onap.aai.domain.yang.Tenant aaiTenant) {
417 Tenant tenant = new Tenant();
418 if (aaiTenant != null) {
419 modelMapper.map(aaiTenant, tenant);
424 protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) {
425 Collection collection = new Collection();
426 collection.setId(aaiCollection.getCollectionId());
427 collection.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiCollection.getOrchestrationStatus()));
431 protected org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup mapAAIInstanceGroupIntoInstanceGroup(
432 org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup) {
433 return modelMapper.map(aaiInstanceGroup, org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup.class);
436 public RouteTableReference mapAAIRouteTableReferenceIntoRouteTableReference(
437 org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference) {
438 return modelMapper.map(aaiRouteTableReference, RouteTableReference.class);
441 protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) {
442 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
443 ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class);
444 modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork);
445 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
446 return modelInfoNetwork;
449 protected ModelInfoGenericVnf mapCatalogVnfToVnf(VnfResourceCustomization vnfResourceCustomization) {
450 ModelInfoGenericVnf modelInfoVnf = modelMapper.map(vnfResourceCustomization, ModelInfoGenericVnf.class);
451 modelMapper.map(vnfResourceCustomization.getVnfResources(), modelInfoVnf);
455 protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) {
456 ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class);
457 modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule);
458 return modelInfoVfModule;
461 protected Platform mapRequestPlatform(org.onap.so.serviceinstancebeans.Platform platform) {
462 return modelMapper.map(platform, Platform.class);
465 protected LineOfBusiness mapRequestLineOfBusiness(org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness) {
466 return modelMapper.map(lineOfBusiness, LineOfBusiness.class);
469 public Configuration mapAAIConfiguration(org.onap.aai.domain.yang.Configuration configurationAAI) {
470 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
471 Configuration configuration = modelMapper.map(configurationAAI, Configuration.class);
472 modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
473 configuration.getForwarderEvcs().addAll(mapAllForwarderEvcs(configurationAAI));
474 configuration.getEvcs().addAll(mapAllEvcs(configurationAAI));
476 .setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(configurationAAI.getOrchestrationStatus()));
477 return configuration;
480 protected List<Evc> mapAllEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
481 List<Evc> listOfEvcs = new ArrayList<>();
482 if (configurationAAI.getEvcs() != null) {
483 for (org.onap.aai.domain.yang.Evc aaiEvc : configurationAAI.getEvcs().getEvc()) {
484 listOfEvcs.add(mapEvc(aaiEvc));
490 protected Evc mapEvc(org.onap.aai.domain.yang.Evc aaiEvc) {
491 return modelMapper.map(aaiEvc, Evc.class);
494 protected List<ForwarderEvc> mapAllForwarderEvcs(org.onap.aai.domain.yang.Configuration configurationAAI) {
495 List<ForwarderEvc> listOfForwarderEvcs = new ArrayList<>();
496 if (configurationAAI.getForwarderEvcs() != null) {
497 for (org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc : configurationAAI.getForwarderEvcs()
498 .getForwarderEvc()) {
499 listOfForwarderEvcs.add(mapForwarderEvc(aaiForwarderEvc));
502 return listOfForwarderEvcs;
505 protected ForwarderEvc mapForwarderEvc(org.onap.aai.domain.yang.ForwarderEvc aaiForwarderEvc) {
506 return modelMapper.map(aaiForwarderEvc, ForwarderEvc.class);
509 protected OwningEntity mapRequestOwningEntity(org.onap.so.serviceinstancebeans.OwningEntity owningEntity) {
510 return modelMapper.map(owningEntity, OwningEntity.class);
513 protected Project mapRequestProject(org.onap.so.serviceinstancebeans.Project project) {
514 return modelMapper.map(project, Project.class);
517 protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
518 ConfigurationResourceCustomization configurationResourceCustomization,
519 CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
520 ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
521 modelInfoConfiguration
522 .setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
523 modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
524 modelInfoConfiguration.setModelInvariantId(
525 configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
526 modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
527 return modelInfoConfiguration;
530 protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
531 CvnfcConfigurationCustomization cvnfcConfigurationCustomization) {
532 ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
533 modelInfoConfiguration
534 .setModelVersionId(cvnfcConfigurationCustomization.getConfigurationResource().getModelUUID());
535 modelInfoConfiguration.setModelCustomizationId(cvnfcConfigurationCustomization.getModelCustomizationUUID());
536 modelInfoConfiguration.setModelInvariantId(
537 cvnfcConfigurationCustomization.getConfigurationResource().getModelInvariantUUID());
538 modelInfoConfiguration.setPolicyName(cvnfcConfigurationCustomization.getPolicyName());
539 modelInfoConfiguration.setConfigurationType(cvnfcConfigurationCustomization.getConfigurationType());
540 modelInfoConfiguration.setConfigurationRole(cvnfcConfigurationCustomization.getConfigurationRole());
541 return modelInfoConfiguration;
544 public NetworkResourceCustomization mapCollectionNetworkResourceCustToNetworkResourceCust(
545 CollectionNetworkResourceCustomization collectionNetworkResourceCust) {
546 return modelMapper.map(collectionNetworkResourceCust, NetworkResourceCustomization.class);
549 public Vnfc mapAAIVnfc(org.onap.aai.domain.yang.Vnfc vnfcAAI) {
550 return modelMapper.map(vnfcAAI, Vnfc.class);