diff options
author | 2019-03-19 13:31:54 +0000 | |
---|---|---|
committer | 2019-03-19 13:31:54 +0000 | |
commit | d0031501cd81a9046396358f42657f168b5a58a8 (patch) | |
tree | 60dc853fa24a9a3c2a1f7854cebdf3cb7a9f8602 /openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java | |
parent | b26a5802920dff540bd8de74b944bb04d431226e (diff) |
Display PNF/VNF Type for PNF (backend)
Change-Id: Ie3fabe2a91c1e9040939e2bfe97705cfee15b201
Issue-ID: SDC-2157
Signed-off-by: kooper <sergey.sachkov@est.tech>
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index 36cd58dabf..5be982bede 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -16,6 +16,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl; +import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA; import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ENTRY_MANIFEST; import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_ORIG_PATH_FILE_NAME; import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_META_PATH_FILE_NAME; @@ -62,6 +63,7 @@ import org.openecomp.core.utilities.json.JsonUtil; import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; import org.openecomp.core.validation.api.ValidationManager; import org.openecomp.core.validation.util.MessageContainerUtil; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; import org.openecomp.sdc.common.errors.CoreException; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.errors.ValidationErrorBuilder; @@ -638,6 +640,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa Manifest onboardingManifest = new SOL004ManifestOnboarding(); onboardingManifest.parse(manifestInputStream); etsiService.moveNonManoFileToArtifactFolder(handler, onboardingManifest); + //VSP PNF resource type is supported only for sol004 csar for now, default VSP resource type is VF + packageInfo.setResourceType(getResourceType(onboardingManifest)); } } packageInfo.setTranslatedFile(ByteBuffer.wrap( @@ -647,6 +651,17 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa return packageInfo; } + private String getResourceType(Manifest onboardingManifest) { + //Valid manifest should contain whether vnf or pnf related metadata data exclusively in SOL004 standard, + // validation of manifest done during package upload stage + if(onboardingManifest != null && !onboardingManifest.getMetadata().isEmpty() + && MANIFEST_PNF_METADATA.stream().anyMatch(e -> onboardingManifest.getMetadata().containsKey(e))){ + return ResourceTypeEnum.PNF.name(); + } + //VNF is default resource type + return ResourceTypeEnum.VF.name(); + } + private InputStream getManifest(FileContentHandler handler) throws IOException { ToscaMetadata metadata = getMetadata(handler); return getManifestInputStream(handler, metadata.getMetaEntries().get(TOSCA_META_ENTRY_MANIFEST)); |