summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorsanket12345 <SX00562924@techmahindra.com>2022-10-18 17:13:00 +0530
committersanket12345 <SX00562924@techmahindra.com>2022-10-18 17:14:53 +0530
commit878a6668ed9031e61c672d5554573fb13ae05cde (patch)
tree1cc13ff025e3dfffdf9e022e69a23612c8f6803b /bpmn
parent105066944adc715547cc7cc03dc3abfdd15567dc (diff)
Adding CNF Upgrade Code Enhancements
-Code Enhanced for CNF- Upgrade. -Code changes Deactivate older version of VfModule & VNFs while upgradation by giving older version inputs to SDNC. -Enabled onap-model-info true for Deactivate, which can be now seen in logs while Deactivation of VfModule/VNF. -New changes enable to fetch data from UserParams instead of RelatedInstanceList, which will further simplify the payload. Issue-ID: SO-3857 Change-Id: I99f71f025d813b413f82f1a802bab8867d0a9cbb Signed-off-by: sanket12345 <SX00562924@techmahindra.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java58
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java2
3 files changed, 41 insertions, 21 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 f192024007..9031294f41 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
@@ -24,6 +24,7 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -1490,24 +1491,35 @@ public class BBInputSetup implements JavaDelegate {
cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
}
gBB.setCloudRegion(cloudRegion);
+
+ /*
+ * Below check is for CNF-Upgrade only. Reads new version VNF/VF-Module details from UserParams and delegates to
+ * BBs. Reads data from RequestDetails.
+ */
String upgradeCnfModelCustomizationUUID = "";
String upgradeCnfVfModuleModelCustomizationUUID = "";
String upgradeCnfModelVersionId = "";
String upgradeCnfVfModuleModelVersionId = "";
- if (requestDetails.getRelatedInstanceList() != null) {
- for (RelatedInstanceList relatedInstList : requestDetails.getRelatedInstanceList()) {
- RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
- // condition -1
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)
- && requestAction.equalsIgnoreCase("upgradeCnf")) {
- upgradeCnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
- upgradeCnfModelVersionId = relatedInstance.getModelInfo().getModelVersionId();
- }
- // condition -2
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vfModule)
- && parameter.getRequestAction().equals("upgradeCnf")) {
- upgradeCnfVfModuleModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
- upgradeCnfVfModuleModelVersionId = relatedInstance.getModelInfo().getModelVersionId();
+ if (requestDetails.getRelatedInstanceList() != null && requestAction.equalsIgnoreCase("upgradeCnf")) {
+ if (requestDetails.getRequestParameters().getUserParams() != null) {
+ List<RequestParameters> requestParams = new ArrayList<>();
+ requestParams.add(requestDetails.getRequestParameters());
+ for (RequestParameters reqParam : requestParams) {
+ for (Map<String, Object> params : reqParam.getUserParams()) {
+ if (params.containsKey("service")) {
+ org.onap.so.serviceinstancebeans.Service services = serviceMapper(params);
+ List<Vnfs> vnfs = services.getResources().getVnfs();
+ for (Vnfs vnfobj : vnfs) {
+ for (VfModules vfMod : vnfobj.getVfModules()) {
+ upgradeCnfModelCustomizationUUID = vnfobj.getModelInfo().getModelCustomizationId();
+ upgradeCnfModelVersionId = vnfobj.getModelInfo().getModelVersionId();
+ upgradeCnfVfModuleModelCustomizationUUID =
+ vfMod.getModelInfo().getModelCustomizationId();
+ upgradeCnfVfModuleModelVersionId = vfMod.getModelInfo().getModelVersionId();
+ }
+ }
+ }
+ }
}
}
}
@@ -1518,7 +1530,8 @@ public class BBInputSetup implements JavaDelegate {
&& genericVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
org.onap.aai.domain.yang.GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(genericVnf.getVnfId());
ModelInfo modelInfo = new ModelInfo();
- if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null) {
+ if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null
+ && !(bbName.contains("Deactivate"))) {
modelInfo.setModelCustomizationUuid(upgradeCnfModelCustomizationUUID);
modelInfo.setModelVersionId(upgradeCnfModelVersionId);
this.mapCatalogVnf(genericVnf, modelInfo, service);
@@ -1539,7 +1552,8 @@ public class BBInputSetup implements JavaDelegate {
String vnfModelCustomizationUUID =
this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
ModelInfo vnfModelInfo = new ModelInfo();
- if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null) {
+ if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null
+ && !(bbName.contains("Deactivate"))) {
vnfModelInfo.setModelCustomizationUuid(upgradeCnfModelCustomizationUUID);
vnfModelInfo.setModelVersionId(upgradeCnfModelVersionId);
this.mapCatalogVnf(vnf, vnfModelInfo, service);
@@ -1551,12 +1565,12 @@ public class BBInputSetup implements JavaDelegate {
String vfModuleCustomizationUUID = this.bbInputSetupUtils
.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId();
ModelInfo vfModuleModelInfo = new ModelInfo();
- if ("upgradeCnf".equalsIgnoreCase(requestAction)
- && upgradeCnfVfModuleModelCustomizationUUID != null) {
+ if ("upgradeCnf".equalsIgnoreCase(requestAction) && upgradeCnfModelCustomizationUUID != null
+ && !(bbName.contains("Deactivate"))) {
vfModuleModelInfo.setModelCustomizationUuid(upgradeCnfVfModuleModelCustomizationUUID);
vfModuleModelInfo.setModelVersionId(upgradeCnfVfModuleModelVersionId);
this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service,
- upgradeCnfVfModuleModelCustomizationUUID);
+ upgradeCnfModelCustomizationUUID);
} else {
vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID);
this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID);
@@ -2211,6 +2225,12 @@ public class BBInputSetup implements JavaDelegate {
return collection;
}
+ private org.onap.so.serviceinstancebeans.Service serviceMapper(Map<String, Object> params) throws IOException {
+ ObjectMapper obj = new ObjectMapper();
+ String input = obj.writeValueAsString(params.get("service"));
+ return obj.readValue(input, org.onap.so.serviceinstancebeans.Service.class);
+ }
+
private void setisHelmforHealthCheckBB(Service service, ServiceInstance serviceInstance, GeneralBuildingBlock gBB) {
for (GenericVnf vnf : serviceInstance.getVnfs()) {
for (VfModule vfModule : vnf.getVfModules()) {
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn
index dcfc8344f8..6649e93904 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn
@@ -15,7 +15,7 @@
<bpmn:incoming>SequenceFlow_1xr6chl</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:serviceTask id="UpdateVfModuleStatus" name="&#10;AAI&#10;Update&#10;(vf module) - Pending Activation&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:serviceTask id="UpdateVfModuleStatus" name="AAI&#10;Update&#10;(vf module)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0rds4rj</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1vbwdaw</bpmn:outgoing>
</bpmn:serviceTask>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index 901187e231..5852767957 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -87,7 +87,7 @@ public class VfModuleTopologyOperationRequestMapper {
} else if (svcAction.equals(SDNCSvcAction.DEACTIVATE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DEACTIVATE;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
- includeModelInformation = false;
+ includeModelInformation = true;
} else if (svcAction.equals(SDNCSvcAction.DELETE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DELETE;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;