From d4de474780d0ab820f2133a7ff368cc24939397d Mon Sep 17 00:00:00 2001 From: "aleem.raja@t-systems.com" Date: Wed, 7 Sep 2022 15:54:04 +0530 Subject: Update nf_type for PNF in AAI Update nf_type for PNF in AAI to distinguish different PNFs nf_type value will come from SDC properties Issue-ID: SO-3967 Signed-off-by: aleem.raja@t-systems.com Change-Id: I9dd039ac098a60f7cf4d4a9c456c7681f64d9987 --- .../modelinfo/ModelInfoPnf.java | 23 ++++++++++++++++++ .../servicedecomposition/tasks/BBInputSetup.java | 28 ++++++++++++++++++++++ .../tasks/BBInputSetupMapperLayer.java | 8 +++++++ 3 files changed, 59 insertions(+) (limited to 'bpmn/MSOCommonBPMN/src/main/java/org') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java index a01fa9698b..9b81979222 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java @@ -20,8 +20,31 @@ package org.onap.so.bpmn.servicedecomposition.modelinfo; +import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; public class ModelInfoPnf extends ModelInfoMetadata implements Serializable { private static final long serialVersionUID = 50687109134317615L; + + @JsonProperty("nf-role") + private String role; + + @JsonProperty("nf-type") + private String NfType; + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getNfType() { + return NfType; + } + + public void setNfType(String nfType) { + NfType = nfType; + } } 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 a0784b375e..c36aaac5e1 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 @@ -86,6 +86,7 @@ import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; @@ -982,6 +983,13 @@ public class BBInputSetup implements JavaDelegate { } } + protected void mapCatalogPnf(Pnf pnf, ModelInfo modelInfo, Service service) { + PnfResourceCustomization pnfResourceCustomization = getPnfResourceCustomizationFromService(modelInfo, service); + if (pnfResourceCustomization != null) { + pnf.setModelInfoPnf(this.mapperLayer.mapCatalogPnfToPnf(pnfResourceCustomization)); + } + } + protected VnfResourceCustomization getVnfResourceCustomizationFromService(ModelInfo modelInfo, Service service) { VnfResourceCustomization vnfResourceCustomization = null; for (VnfResourceCustomization resourceCust : service.getVnfCustomizations()) { @@ -993,6 +1001,17 @@ public class BBInputSetup implements JavaDelegate { return vnfResourceCustomization; } + protected PnfResourceCustomization getPnfResourceCustomizationFromService(ModelInfo modelInfo, Service service) { + PnfResourceCustomization pnfResourceCustomization = null; + for (PnfResourceCustomization resourceCust : service.getPnfCustomizations()) { + if (resourceCust.getModelCustomizationUUID().equalsIgnoreCase(modelInfo.getModelCustomizationUuid())) { + pnfResourceCustomization = resourceCust; + break; + } + } + return pnfResourceCustomization; + } + protected void populateL3Network(BBInputSetupParameter parameter) { L3Network network = null; for (L3Network networkTemp : parameter.getServiceInstance().getNetworks()) { @@ -1645,6 +1664,15 @@ public class BBInputSetup implements JavaDelegate { .filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst() .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance)); } + + serviceInstance.getPnfs().stream().filter(pnf -> pnfInstanceName.equalsIgnoreCase(pnf.getPnfName())) + .findFirst().ifPresent(pnf -> { + ModelInfo pnfModelInfo = new ModelInfo(); + pnfModelInfo.setModelCustomizationUuid(pnf.getModelInfoPnf().getModelCustomizationUuid()); + pnfModelInfo.setModelCustomizationId(pnf.getModelInfoPnf().getModelCustomizationUuid()); + mapCatalogPnf(pnf, pnfModelInfo, service); + }); + } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP) || (bbName.contains(CONTROLLER) && (VF_MODULE).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope()))) { String vfModuleInstanceName = lookupKeyMap.get(ResourceKey.VF_MODULE_INSTANCE_NAME); 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 2bb383e4ec..759c9ec46a 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 @@ -65,6 +65,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; @@ -79,6 +80,7 @@ import org.onap.so.db.catalog.beans.InstanceGroupType; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; @@ -480,6 +482,12 @@ public class BBInputSetupMapperLayer { return modelInfoVnf; } + protected ModelInfoPnf mapCatalogPnfToPnf(PnfResourceCustomization pnfResourceCustomization) { + ModelInfoPnf modelInfoPnf = modelMapper.map(pnfResourceCustomization, ModelInfoPnf.class); + modelMapper.map(pnfResourceCustomization.getPnfResources(), modelInfoPnf); + return modelInfoPnf; + } + protected ModelInfoVfModule mapCatalogVfModuleToVfModule(VfModuleCustomization vfResourceCustomization) { ModelInfoVfModule modelInfoVfModule = modelMapper.map(vfResourceCustomization, ModelInfoVfModule.class); modelMapper.map(vfResourceCustomization.getVfModule(), modelInfoVfModule); -- cgit 1.2.3-korg