aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src
diff options
context:
space:
mode:
authorKalkere Ramesh, Sharan <sharan.kalkere.ramesh@att.com>2020-02-27 09:29:26 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-03-05 14:10:36 -0500
commit5611741592b4a12c411eb83054318f4da86a1ead (patch)
tree6df569eecb27c12827121aacd19f678b92f62ed7 /bpmn/MSOCommonBPMN/src
parent03117ffcb30ef5735a46c72a5f7ba10cdb66dc37 (diff)
update bbinputsetup to handle volume group replace
update bbinputsetup to handle volume group replace fixed unit tests and updated related instance check updated fetch of volume group in mapper layer Issue-ID: SO-2682 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I48266f9e7e681a4fc31a8732aa06efb95bfb01b5
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json5
4 files changed, 55 insertions, 12 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index e7e51bba77..f0954c3695 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -662,6 +662,7 @@ public class BBInputSetup implements JavaDelegate {
}
protected void populateVolumeGroup(BBInputSetupParameter parameter) throws Exception {
+ String replaceVnfModelCustomizationUUID = null;
VolumeGroup volumeGroup = null;
GenericVnf vnf = null;
String vnfModelCustomizationUUID = null;
@@ -674,7 +675,11 @@ public class BBInputSetup implements JavaDelegate {
for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
- vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
+ if (parameter.getIsReplace()) {
+ replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
+ } else {
+ vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
+ }
break;
}
}
@@ -685,8 +690,13 @@ public class BBInputSetup implements JavaDelegate {
vnfModelCustomizationUUID =
bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
ModelInfo vnfModelInfo = new ModelInfo();
- vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
- mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getService());
+ if (parameter.getIsReplace()) {
+ vnfModelInfo.setModelCustomizationUuid(replaceVnfModelCustomizationUUID);
+ mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getNewService());
+ } else {
+ vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
+ mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getCurrentService());
+ }
break;
}
}
@@ -696,6 +706,22 @@ public class BBInputSetup implements JavaDelegate {
&& volumeGroupTemp.getVolumeGroupId()
.equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) {
volumeGroup = volumeGroupTemp;
+ if (volumeGroup.getModelInfoVfModule() == null) {
+ throw new Exception(
+ "ModelInfoVfModule is null for VolumeGroup: " + volumeGroup.getVolumeGroupId());
+ }
+ String volumeGroupCustId = volumeGroup.getModelInfoVfModule().getModelCustomizationUUID();
+ ModelInfo modelInfoVolumeGroup = new ModelInfo();
+ modelInfoVolumeGroup.setModelCustomizationId(volumeGroupCustId);
+ if (parameter.getIsReplace() && parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID) != null
+ && volumeGroupTemp.getVolumeGroupId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) {
+ mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup,
+ parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
+ } else {
+ mapCatalogVolumeGroup(volumeGroupTemp, modelInfoVolumeGroup,
+ parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID);
+ }
break;
}
}
@@ -703,10 +729,13 @@ public class BBInputSetup implements JavaDelegate {
volumeGroup = createVolumeGroup(parameter.getLookupKeyMap(), parameter.getResourceId(),
parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams());
vnf.getVolumeGroups().add(volumeGroup);
- }
- if (volumeGroup != null) {
- mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), parameter.getService(),
- vnfModelCustomizationUUID);
+ if (parameter.getIsReplace()) {
+ mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(),
+ parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
+ } else {
+ mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(),
+ parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID);
+ }
}
} else {
logger.debug("Related VNF instance Id not found: {}",
@@ -1514,6 +1543,9 @@ public class BBInputSetup implements JavaDelegate {
parameter.setInstanceName(vfModules.getVolumeGroupInstanceName());
parameter.setVnfType(vnfType);
parameter.setInstanceParams(vfModules.getInstanceParams());
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+ parameter.setServiceModel(serviceModel);
this.populateVolumeGroup(parameter);
} else {
parameter.setResourceId(lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 28ec71b13f..67d073d7b6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -186,6 +186,9 @@ public class BBInputSetupMapperLayer {
protected VolumeGroup mapAAIVolumeGroup(org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup) {
VolumeGroup volumeGroup = modelMapper.map(aaiVolumeGroup, VolumeGroup.class);
+ ModelInfoVfModule modelInfo = new ModelInfoVfModule();
+ modelInfo.setModelCustomizationUUID(aaiVolumeGroup.getModelCustomizationId());
+ volumeGroup.setModelInfoVfModule(modelInfo);
volumeGroup.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiVolumeGroup.getOrchestrationStatus()));
return volumeGroup;
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 1acf4edb4a..df7337c0d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -888,7 +888,6 @@ public class BBInputSetupTest {
verify(SPY_bbInputSetup, times(1)).populateGenericVnf(parameter);
assertEquals("VnfId populated", true,
lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId));
-
doReturn(ModelType.volumeGroup).when(modelInfo).getModelType();
resourceId = "volumeGroupId";
parameter.setResourceId(resourceId);
@@ -1159,12 +1158,13 @@ public class BBInputSetupTest {
ModelInfo mi = new ModelInfo();
mi.setModelType(ModelType.vnf);
mi.setModelCustomizationUuid("vnfModelCustomizationUUID");
+ mi.setModelCustomizationId("vnfModelCustomizationUUID");
ri.setModelInfo(mi);
ril.setRelatedInstance(ri);
requestDetails.setRelatedInstanceList(new RelatedInstanceList[] {ril});
ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelType(ModelType.volumeGroup);
+ modelInfo.setModelCustomizationId("volumeGroupCustId");
RequestInfo reqInfo = new RequestInfo();
reqInfo.setInstanceName("volumeGroupName");
@@ -1178,6 +1178,8 @@ public class BBInputSetupTest {
VolumeGroup vg = new VolumeGroup();
vg.setVolumeGroupName("volumeGroupName");
vg.setVolumeGroupId("volumeGroupId");
+ vg.setModelInfoVfModule(new ModelInfoVfModule());
+ vg.getModelInfoVfModule().setModelCustomizationUUID("volumeGroupCustId");
vnf.getVolumeGroups().add(vg);
serviceInstance.getVnfs().add(vnf);
@@ -1186,6 +1188,8 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
String bbName = AssignFlows.VOLUME_GROUP.toString();
String resourceId = "123";
doNothing().when(SPY_bbInputSetup).mapCatalogVolumeGroup(isA(VolumeGroup.class), eq(modelInfo), eq(service),
@@ -1198,9 +1202,10 @@ public class BBInputSetupTest {
BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
.setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
.setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRequestDetails(requestDetails)
- .setInstanceName(reqInfo.getInstanceName()).build();
+ .setInstanceName(reqInfo.getInstanceName()).setServiceModel(serviceModel).build();
SPY_bbInputSetup.populateVolumeGroup(parameter);
- verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID");
+ verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(eq(vg), isA(ModelInfo.class), eq(service),
+ eq("vnfModelCustomizationUUID"));
vnf.getVolumeGroups().clear();
SPY_bbInputSetup.populateVolumeGroup(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service,
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
index bcc565dc75..7de6df617b 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
@@ -4,5 +4,8 @@
"vnf-type":"vnfType",
"orchestration-status":"PRECREATED",
"cloud-params":{},
- "heat-stack-id":"heatStackId"
+ "heat-stack-id":"heatStackId",
+ "model-info-vf-module": {
+ "modelCustomizationUUID": "modelCustomizationId"
+ }
}