diff options
Diffstat (limited to 'openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java')
1 files changed, 2 insertions, 15 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java index 473d68e49a..9e380a355c 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004Version3MetaDirectoryValidator.java @@ -23,24 +23,18 @@ import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA_L import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_PNF_METADATA_VERSION_3; import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_VNF_METADATA_LIMIT_VERSION_3; import static org.openecomp.sdc.tosca.csar.CSARConstants.MANIFEST_VNF_METADATA_VERSION_3; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_TYPE_PNF; -import static org.openecomp.sdc.tosca.csar.CSARConstants.TOSCA_TYPE_VNF; -import static org.openecomp.sdc.tosca.csar.ManifestTokenType.COMPATIBLE_SPECIFICATION_VERSIONS; +import com.google.common.collect.ImmutableSet; import java.util.List; import java.util.Map; import java.util.stream.Collectors; - import org.openecomp.sdc.common.errors.Messages; import org.openecomp.sdc.datatypes.error.ErrorLevel; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.csar.ToscaMetaEntry; -import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.exceptions.InvalidManifestMetadataException; import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager; -import com.google.common.collect.ImmutableSet; - /** * Validates the contents of the package to ensure it complies with the "CSAR with TOSCA-Metadata directory" structure * as defined in ETSI GS NFV-SOL 004 v3.3.1. @@ -81,13 +75,6 @@ class SOL004Version3MetaDirectoryValidator extends SOL004MetaDirectoryValidator protected boolean isPnfMetadata(final Map<String, String> metadata) { List<String> keys = metadata.keySet().stream().collect(Collectors.toList()); //Both VNF and PNF share this attribute - keys.remove(COMPATIBLE_SPECIFICATION_VERSIONS.getToken()); - final String expectedMetadataType = - keys.get(0).contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF; - if (keys.stream() - .anyMatch(k -> !k.contains(expectedMetadataType))) { - throw new InvalidManifestMetadataException(Messages.MANIFEST_METADATA_INVALID_ENTRY.getErrorMessage()); - } - return expectedMetadataType.equals(TOSCA_TYPE_PNF); + return validatorUtils.isPnfMetadata(keys); } } |