aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java/org/onap
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-09 09:32:29 -0400
committerMarcus Williams <marcus.williams@intel.com>2018-08-09 22:34:52 +0000
commit709352852e50aa92edc9cf80a7d1c0387c532521 (patch)
treeecdb8b85504808f7c35f76ab6332cbab9f320b3b /bpmn/so-bpmn-tasks/src/main/java/org/onap
parentf690106dbb6f2da96fdaa35541bc5ba152f9d299 (diff)
GR-API flow, VF Module, SDNC GR API Fixes
Fixes the new GR-API flow Various fixes in the create VF Module area Fixes issues parsing the SDNC GR API response Fixes new resource type in ASDC controller Fixes AppC mismatch in JSON marshaling Issue-ID: SO-821 Change-Id: I4ace0d348483ab1303fcfee26c5801674be51466 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org/onap')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java80
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java11
8 files changed, 161 insertions, 73 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 69fc633bbd..3456fa1c56 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -92,13 +92,18 @@ public class VnfAdapterCreateTasks {
ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ VolumeGroup volumeGroup = null;
+ try {
+ volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ } catch(BBObjectNotFoundException bbException) {
+ }
CloudRegion cloudRegion = gBBInput.getCloudRegion();
RequestContext requestContext = gBBInput.getRequestContext();
OrchestrationContext orchestrationContext = gBBInput.getOrchContext();
String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId());
- CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+ CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
index fd5f00ed6f..6fcad95144 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
@@ -26,6 +26,7 @@ public class Resource {
private WorkflowType resourceType;
private boolean generated;
private boolean baseVfModule;
+ private String virtualLinkKey;
public Resource(WorkflowType resourceType, String resourceId, boolean generated){
this.resourceId = resourceId;
@@ -57,4 +58,10 @@ public class Resource {
public void setBaseVfModule(boolean baseVfModule) {
this.baseVfModule = baseVfModule;
}
+ public String getVirtualLinkKey() {
+ return virtualLinkKey;
+ }
+ public void setVirtualLinkKey(String virtualLinkKey) {
+ this.virtualLinkKey = virtualLinkKey;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 0f02928d16..c6a63e1431 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
@@ -159,7 +160,7 @@ public class WorkflowAction {
}
for (OrchestrationFlow orchFlow : orchFlows) {
ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false);
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null);
flowsToExecute.add(ebb);
}
} else {
@@ -264,6 +265,7 @@ public class WorkflowAction {
execution.setVariable("flowsToExecute", flowsToExecute);
} catch (Exception ex) {
+ msoLogger.error(ex);
buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
}
}
@@ -289,7 +291,7 @@ public class WorkflowAction {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
- updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type));
+ updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null);
}
});
}
@@ -309,12 +311,13 @@ public class WorkflowAction {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
- updateWorkflowResourceIds(flowsToExecute, type, resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
- .collect(Collectors.toList()).get(i).getResourceId(), null); }
+ Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
+ .collect(Collectors.toList()).get(i);
+ updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); }
});
}
- protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id){
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){
String resourceId = id;
if(resourceId==null){
resourceId = UUID.randomUUID().toString();
@@ -335,6 +338,12 @@ public class WorkflowAction {
}
ebb.setWorkflowResourceIds(workflowResourceIds);
}
+ if(virtualLinkKey != null && ebb.getBuildingBlock().getIsVirtualLink()
+ && virtualLinkKey.equalsIgnoreCase(ebb.getBuildingBlock().getVirtualLinkKey())) {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setNetworkId(resourceId);
+ ebb.setWorkflowResourceIds(workflowResourceIds);
+ }
}
}
@@ -381,18 +390,29 @@ public class WorkflowAction {
InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
CollectionResourceInstanceGroupCustomization collectionInstCust = null;
if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- collectionInstCust = instanceGroup.getCollectionInstanceGroupCustomizations().get(0);
- if(collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
+ for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) {
+ if(collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
+ break;
+ }
+ }
+ if(collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
}
}
msoLogger.debug("minNetworks: " + minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) {
+ if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
+ }
for (int i = 0; i < minNetworks; i++) {
- if(collectionInstCust != null) {
-
- resourceCounter.add(
- new Resource(WorkflowType.VIRTUAL_LINK,instanceGroup.getCollectionNetworkResourceCustomizations()
- .get(0).getModelCustomizationUUID(),false));
+ if(collectionNetworkResourceCust != null && collectionInstCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,collectionNetworkResourceCust.getModelCustomizationUUID(),false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceCounter.add(resource);
}
}
} else {
@@ -633,7 +653,7 @@ public class WorkflowAction {
if (vnf != null && vnf.getVfModules() != null) {
for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) {
Optional<VolumeGroup> volumeGroupFromVfModule = bbInputSetupUtils
- .getRelatedVolumeGroupByNameFromVfModule(vfModule.getVfModuleId(), instanceName);
+ .getRelatedVolumeGroupByNameFromVfModule(vnf.getVnfId(), vfModule.getVfModuleId(), instanceName);
if (volumeGroupFromVfModule.isPresent()) {
return volumeGroupFromVfModule.get().getVolumeGroupId();
}
@@ -642,6 +662,7 @@ public class WorkflowAction {
}
return generatedResourceId;
} catch (Exception ex) {
+ msoLogger.error(ex);
throw new IllegalStateException(
"WorkflowAction was unable to verify if the instance name already exist in AAI.");
}
@@ -666,20 +687,32 @@ public class WorkflowAction {
for (ExecuteBuildingBlock ebb : orchFlows) {
if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) {
String key = ebb.getBuildingBlock().getKey();
+ boolean isVirtualLink = ebb.getBuildingBlock().getIsVirtualLink();
+ String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
sortedOrchFlows.add(ebb);
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
+ if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
}
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
+ if(isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ && ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
+ sortedOrchFlows.add(ebb2);
+ break;
+ }
}
} else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
|| ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) {
@@ -729,48 +762,49 @@ public class WorkflowAction {
workflowResourceIds.setServiceInstanceId(resourceId);
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType())
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
} else if (orchFlow.getFlowName().contains(VNF)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType())
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
} else if (orchFlow.getFlowName().contains(NETWORK)
&& !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType())
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true));
+ Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
+ .collect(Collectors.toList()).get(i);
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource.getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey()));
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
.collect(Collectors.toList()));
for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
} else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType())
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
} else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
} else {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false));
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
}
return flowsToExecute;
@@ -778,13 +812,14 @@ public class WorkflowAction {
protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key,
String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink) {
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey) {
ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
BuildingBlock buildingBlock = new BuildingBlock();
buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
buildingBlock.setMsoId(UUID.randomUUID().toString());
buildingBlock.setKey(key);
buildingBlock.setIsVirtualLink(isVirtualLink);
+ buildingBlock.setVirtualLinkKey(virtualLinkKey);
executeBuildingBlock.setApiVersion(apiVersion);
executeBuildingBlock.setaLaCarte(aLaCarte);
executeBuildingBlock.setRequestAction(requestAction);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index 373ed63fda..94dfdcc747 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -266,6 +266,10 @@ public class AAIObjectMapper {
protected void configure() {
map().setModelInvariantId(source.getModelInfoCollection().getModelInvariantUUID());
map().setModelVersionId(source.getModelInfoCollection().getModelVersionId());
+ map().setCollectionCustomizationId(source.getModelInfoCollection().getModelCustomizationUUID());
+ map().setCollectionFunction(source.getModelInfoCollection().getCollectionFunction());
+ map().setCollectionRole(source.getModelInfoCollection().getCollectionRole());
+ map().setCollectionType(source.getModelInfoCollection().getCollectionType());
map().setCollectionName(source.getName());
}
});
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
index d8dde57135..67e7afb599 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
@@ -20,14 +20,18 @@
package org.onap.so.client.adapter.vnf.mapper;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
-import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.annotation.PostConstruct;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
import org.onap.so.bpmn.core.UrnPropertiesReader;
@@ -41,16 +45,19 @@ import org.onap.so.entity.MsoRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriUtils;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class VnfAdapterObjectMapper {
private ObjectMapper mapper = new ObjectMapper();
+
+ @PostConstruct
+ public void init () {
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ }
public CreateVolumeGroupRequest createVolumeGroupRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest();
@@ -101,7 +108,7 @@ public class VnfAdapterObjectMapper {
final String USER_PARAM_NAME_KEY = "name";
final String USER_PARAM_VALUE_KEY = "value";
// sdncVfModuleQueryResponse will not be available in aLaCarte case
- if (sdncVfModuleQueryResponse != null) {
+ if (sdncVfModuleQueryResponse != null) {
GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class);
buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters());
}
@@ -164,4 +171,4 @@ public class VnfAdapterObjectMapper {
return UrnPropertiesReader.getVariable(key);
}
-}
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index c4dcd1aed9..5f922e0c99 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -30,18 +30,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
-import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
-import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
-import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
-import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.jsonpath.JsonPathUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
+import javax.annotation.PostConstruct;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
@@ -57,18 +46,37 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataInte
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkInformationItems;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkInformationItem;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataNetworkinformationitemsNetworkinformationitemNetworkIps;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataSriovParameters;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNames;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNetworks;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmnamesVnfcNames;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfNetworkData;
-import org.onap.sdnc.northbound.client.model.*;
-
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcNetworkData;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcNetworkData;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfResourceAssignments;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsAvailabilityZones;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfresourceassignmentsVnfresourceassignmentsVnfNetworks;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyVnfTopology;
+import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.entity.MsoRequest;
+import org.onap.so.jsonpath.JsonPathUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -96,19 +104,33 @@ public class VnfAdapterVfModuleObjectMapper {
private static final String FLOATING_V6_IP = "_floating_v6_ip";
private static final String UNDERSCORE = "_";
+ @PostConstruct
+ public void init () {
+ mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
+ }
+
public CreateVfModuleRequest createVfModuleRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
+ VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
- createVfModuleRequest.setVnfType(genericVnf.getVnfType());
+ createVfModuleRequest.setVnfId(genericVnf.getVnfId());
+ createVfModuleRequest.setVnfType(genericVnf.getVnfType());
createVfModuleRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
createVfModuleRequest.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
createVfModuleRequest.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
-
+ if (volumeGroup != null) {
+ createVfModuleRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId());
+ createVfModuleRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId());
+ }
+ VfModule baseVfModule = getBaseVfModule(genericVnf);
+ if (baseVfModule != null) {
+ createVfModuleRequest.setBaseVfModuleId(baseVfModule.getVfModuleId());
+ createVfModuleRequest.setBaseVfModuleStackId(baseVfModule.getHeatStackId());
+ }
createVfModuleRequest.setVfModuleParams(buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse));
createVfModuleRequest.setSkipAAI(true);
@@ -134,6 +156,7 @@ public class VnfAdapterVfModuleObjectMapper {
private Map<String,String> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
+
GenericResourceApiVnftopologyVnfTopology vnfTopology = mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnftopologyVnfTopology.class);
GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class);
Map<String,String> paramsMap = new HashMap<>();
@@ -151,7 +174,10 @@ public class VnfAdapterVfModuleObjectMapper {
buildMandatoryParamsMap(paramsMap, serviceInstance, genericVnf, vfModule);
// Parameters received from the request should overwrite any parameters received from SDNC
- paramsMap.putAll(requestContext.getUserParams());
+
+ if (requestContext.getUserParams() != null) {
+ paramsMap.putAll(requestContext.getUserParams());
+ }
return paramsMap;
}
@@ -348,7 +374,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
private void buildVfModuleSriovParameters(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String networkKey) {
- /** SRIOV Parameters
+ // SRIOV Parameters
GenericResourceApiVmnetworkdataSriovParameters sriovParameters = network.getSriovParameters();
if (sriovParameters != null) {
GenericResourceApiVmnetworkdataSriovparametersHeatVlanFilters heatVlanFilters = sriovParameters.getHeatVlanFilters();
@@ -371,7 +397,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
}
}
- **/
+
}
private void buildVfModuleNetworkInformation(Map<String,String> paramsMap, GenericResourceApiVmNetworkData network, String key, String networkKey) {
@@ -726,4 +752,18 @@ public class VnfAdapterVfModuleObjectMapper {
return json;
}
+
+ private VfModule getBaseVfModule(GenericVnf genericVnf) {
+ List<VfModule> vfModules = genericVnf.getVfModules();
+ VfModule baseVfModule = null;
+ if (vfModules != null) {
+ for(int i = 0; i < vfModules.size(); i++) {
+ if (vfModules.get(i).getModelInfoVfModule().getIsBaseBoolean()) {
+ baseVfModule = vfModules.get(i);
+ break;
+ }
+ }
+ }
+ return baseVfModule;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
index e52616677d..2d9032c7c0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
@@ -28,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
@@ -43,8 +44,8 @@ public class VnfAdapterVfModuleResources {
private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper;
public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException {
- return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+ VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws IOException {
+ return vnfAdapterVfModuleObjectMapper.createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
}
public DeleteVfModuleRequest deleteVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion,
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
index 1ce7a92eb5..5a63d2097b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
@@ -20,11 +20,6 @@
package org.onap.so.client.sdnc;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.util.Collections;
-
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -32,7 +27,6 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
-import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
@@ -69,11 +63,6 @@ public class BaseClient<I,O> {
public O run(I data, HttpMethod method, Object... uriVariables) throws RestClientException {
HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
RestTemplate restTemplate = new RestTemplate();
- ObjectMapper mapper = new ObjectMapper();
- MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
- converter.setObjectMapper(mapper);
- mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
- restTemplate.getMessageConverters().add(0, converter);
restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()));
ParameterizedTypeReference<O> output = new ParameterizedTypeReference<O>() {};
ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, output,