diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main')
4 files changed, 28 insertions, 15 deletions
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java index bdb7bc3a93..9800d02ba6 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java @@ -27,6 +27,7 @@ import org.openecomp.core.model.types.ServiceElement; import org.openecomp.core.translator.datatypes.TranslatorOutput; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.healing.interfaces.Healer; @@ -49,7 +50,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; @@ -300,7 +300,8 @@ public class CompositionDataHealer implements Healer { FileContentHandler fileContentHandler; try { fileContentHandler = - CommonUtil.validateAndUploadFileContent(uploadData.getContentData().array()); + CommonUtil.validateAndUploadFileContent( + OnboardingTypesEnum.ZIP, uploadData.getContentData().array()); return HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler); } catch (Exception e) { return null; diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java index e0b7adb6d3..0d484440cf 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java @@ -22,6 +22,7 @@ package org.openecomp.sdc.healing.healers; import org.openecomp.core.utilities.file.FileContentHandler; import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.datatypes.error.ErrorMessage; @@ -94,7 +95,7 @@ public class FileDataStructureHealer implements Healer { byte[] byteContentData = uploadData.getContentData().array(); FileContentHandler fileContentHandler; try{ - fileContentHandler = CommonUtil.validateAndUploadFileContent(byteContentData); + fileContentHandler = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, byteContentData); Map<String, List<ErrorMessage>> errors = new HashMap<>(); OrchestrationTemplateCandidateData candidateDataEntity = new CandidateEntityBuilder(candidateService) diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java index d5ccd36c95..44b6062e89 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java @@ -8,6 +8,7 @@ import org.openecomp.core.model.dao.ServiceTemplateDaoInter; import org.openecomp.core.model.types.ServiceElement; import org.openecomp.core.translator.datatypes.TranslatorOutput; import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.utils.CommonUtil; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.healing.interfaces.Healer; @@ -53,7 +54,7 @@ public class HeatToToscaTranslationHealer implements Healer { FileContentHandler fileContentHandler; TranslatorOutput translatorOutput; try { - fileContentHandler = CommonUtil.validateAndUploadFileContent(uploadData + fileContentHandler = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadData .getContentData().array()); translatorOutput = HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler); diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java index 5d6050a7f0..0b06fb1c83 100644 --- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java +++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java @@ -1,11 +1,10 @@ package org.openecomp.sdc.healing.healers; +import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.sdc.common.utils.SdcCommon; import org.openecomp.sdc.healing.interfaces.Healer; import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao; -import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao; import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails; @@ -15,15 +14,18 @@ import java.util.Map; import java.util.Objects; public class VspOnboardingMethodHealer implements Healer { - /*private static final VendorSoftwareProductDao vendorSoftwareProductDao = - VendorSoftwareProductDaoFactory.getInstance().createInterface();*/ - private static final VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao = + private static VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao = VendorSoftwareProductInfoDaoFactory.getInstance().createInterface(); private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage(); public VspOnboardingMethodHealer(){ + } + public VspOnboardingMethodHealer( VendorSoftwareProductInfoDao inVendorSoftwareProductInfoDao){ + vendorSoftwareProductInfoDao = inVendorSoftwareProductInfoDao; } + + @Override public Object heal(Map<String, Object> healingParams) throws Exception { mdcDataDebugMessage.debugEntryMessage(null, null); @@ -33,14 +35,22 @@ public class VspOnboardingMethodHealer implements Healer { Version version = (Version) healingParams.get(SdcCommon.VERSION); VspDetails vendorSoftwareProductInfo = vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version)); - vendorSoftwareProductInfo.getOnboardingMethod(); + String onboardingValue = vendorSoftwareProductInfo.getOnboardingMethod(); - if(Objects.isNull(vendorSoftwareProductInfo.getOnboardingMethod())) { - onboardingMethod="HEAT"; - vendorSoftwareProductInfo.setOnboardingMethod(onboardingMethod); - vendorSoftwareProductInfoDao.update(vendorSoftwareProductInfo); - //vendorSoftwareProductDao.updateVendorSoftwareProductInfo(vendorSoftwareProductInfo); + if(Objects.isNull(onboardingValue)) { + onboardingMethod="NetworkPackage"; + + updateVSPInfo(OnboardingTypesEnum.ZIP.toString(), onboardingMethod, vendorSoftwareProductInfo); + } else if (onboardingValue.equals("HEAT")){ + onboardingMethod="NetworkPackage"; + updateVSPInfo(OnboardingTypesEnum.ZIP.toString(),onboardingMethod, vendorSoftwareProductInfo); } return onboardingMethod; } + + private void updateVSPInfo(String onboardingOrigin, String onboardingMethod, VspDetails vendorSoftwareProductInfo) { + vendorSoftwareProductInfo.setOnboardingMethod(onboardingMethod); + vendorSoftwareProductInfo.setOnboardingOrigin(onboardingOrigin); + vendorSoftwareProductInfoDao.update(vendorSoftwareProductInfo); + } } |