summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Malewski <maciej.malewski@nokia.com>2020-11-20 14:33:04 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2020-12-02 13:01:42 +0000
commit8f3f8797dc916be0215523fb3d36f020b4795089 (patch)
tree5d8c7966b669d90dc6123e830a19d652170eb47d
parentad99b805537fc8f3103fa5646abe5342924e10cd (diff)
Validate PMDictionary contents
Validate contents against schema for .csar packs compliant with NFV-SOL 004. Issue-ID: SDC-3390 Signed-off-by: Maciej Malewski <maciej.malewski@nokia.com> Change-Id: Ib768821ad8215105ca4a33953fa9974a63ed76f7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java51
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java101
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java60
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java36
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidatorTest.java77
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java279
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractorTest.java77
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilterTest.java45
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestCompliantWithSOL004.mf27
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-invalid.yaml175
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-valid.yaml8
12 files changed, 759 insertions, 185 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
index a0bcc0f35e..98092c79fd 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
@@ -13,6 +13,9 @@
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
+ * Modifications copyright (c) 2020 Nokia
+ * ================================================================================
+
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
@@ -204,6 +207,11 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.vnfsdk.validation</groupId>
+ <artifactId>validation-pmdictionary</artifactId>
+ <version>${onap.vnfsdk.validation.pmdictionary.version}</version>
+ </dependency>
</dependencies>
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java
new file mode 100644
index 0000000000..a91dd9f445
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidator.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.function.Consumer;
+import java.util.stream.Stream;
+import org.onap.validation.yaml.YamlContentValidator;
+import org.onap.validation.yaml.error.YamlDocumentValidationError;
+
+public class PMDictionaryValidator {
+
+ public void validate(Stream<byte[]> pmDictionaryFiles, Consumer<String> errorReporter) {
+ pmDictionaryFiles
+ .map(this::validate)
+ .flatMap(Collection::stream)
+ .forEach(errorReporter);
+ }
+
+ private List<String> validate(byte[] fileContent) {
+ List<String> errors = new ArrayList<>();
+ try {
+ List<YamlDocumentValidationError> validationErrors = new YamlContentValidator().validate(fileContent);
+ validationErrors.stream()
+ .map(YamlDocumentValidationError::getMessage)
+ .forEach(errors::add);
+ } catch (Exception e) {
+ errors.add(e.getMessage());
+ }
+ return errors;
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
index f41b44fd79..6107383485 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidator.java
@@ -16,6 +16,8 @@
*
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
+ * * Modifications copyright (c) 2020 Nokia
+ * ================================================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
@@ -53,6 +55,8 @@ import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
+
+import java.util.stream.Stream;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FilenameUtils;
import org.openecomp.core.impl.ToscaDefinitionImportHandler;
@@ -74,6 +78,8 @@ import org.openecomp.sdc.tosca.csar.ToscaMetaEntry;
import org.openecomp.sdc.tosca.csar.ToscaMetadata;
import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.OnboardingPackageContentHandler;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.exception.MissingCertificateException;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.utils.FileExtractor;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.utils.InternalFilesFilter;
import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.exceptions.InvalidManifestMetadataException;
import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManager;
import org.openecomp.sdc.vendorsoftwareproduct.security.SecurityManagerException;
@@ -94,6 +100,7 @@ class SOL004MetaDirectoryValidator implements Validator {
private OnboardingPackageContentHandler contentHandler;
private Set<String> folderList;
private ToscaMetadata toscaMetadata;
+ private final InternalFilesFilter internalFilesFilter = new InternalFilesFilter();
public SOL004MetaDirectoryValidator() {
securityManager = SecurityManager.getInstance();
@@ -114,6 +121,7 @@ class SOL004MetaDirectoryValidator implements Validator {
if (packageHasCertificate()) {
verifySignedFiles();
}
+ validatePMDictionaryContentsAgainstSchema();
return Collections.unmodifiableMap(getAnyValidationErrors());
}
@@ -132,8 +140,8 @@ class SOL004MetaDirectoryValidator implements Validator {
private void parseToscaMetadata() {
try {
toscaMetadata =
- OnboardingToscaMetadata
- .parseToscaMetadataFile(contentHandler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME));
+ OnboardingToscaMetadata
+ .parseToscaMetadataFile(contentHandler.getFileContentAsStream(TOSCA_META_PATH_FILE_NAME));
} catch (final IOException e) {
reportError(ErrorLevel.ERROR, Messages.METADATA_PARSER_INTERNAL.getErrorMessage());
LOGGER.error(Messages.METADATA_PARSER_INTERNAL.getErrorMessage(), e.getMessage(), e);
@@ -153,7 +161,7 @@ class SOL004MetaDirectoryValidator implements Validator {
final Map<String, String> signedFileMap = contentHandler.getFileAndSignaturePathMap(SecurityManager.ALLOWED_SIGNATURE_EXTENSIONS);
final String packageCertificatePath = getCertificatePath().orElse(null);
final byte[] packageCert = contentHandler.getFileContent(packageCertificatePath);
- if(packageCert == null) {
+ if (packageCert == null) {
throw new MissingCertificateException("Expected package certificate");
}
signedFileMap.entrySet().stream().filter(entry -> entry.getValue() != null).forEach(entry -> {
@@ -164,11 +172,11 @@ class SOL004MetaDirectoryValidator implements Validator {
try {
if (!securityManager.verifySignedData(fileSignatureBytes, packageCert, fileBytes)) {
reportError(ErrorLevel.ERROR,
- Messages.ARTIFACT_INVALID_SIGNATURE.formatMessage(fileSignaturePath, filePath));
+ Messages.ARTIFACT_INVALID_SIGNATURE.formatMessage(fileSignaturePath, filePath));
}
} catch (final SecurityManagerException e) {
final String errorMessage = Messages.ARTIFACT_SIGNATURE_VALIDATION_ERROR
- .formatMessage(fileSignaturePath, filePath, packageCertificatePath, e.getMessage());
+ .formatMessage(fileSignaturePath, filePath, packageCertificatePath, e.getMessage());
reportError(ErrorLevel.ERROR, errorMessage);
LOGGER.error(errorMessage, e);
}
@@ -185,7 +193,7 @@ class SOL004MetaDirectoryValidator implements Validator {
}
if (!mainDefinitionFileName.equals(manifestFileName)) {
reportError(ErrorLevel.ERROR, String.format(Messages.MANIFEST_INVALID_NAME.getErrorMessage(),
- manifestFileName, mainDefinitionFileName));
+ manifestFileName, mainDefinitionFileName));
}
}
@@ -200,14 +208,14 @@ class SOL004MetaDirectoryValidator implements Validator {
private boolean hasETSIMetadata() {
final Map<String, String> entries = toscaMetadata.getMetaEntries();
return hasEntry(entries, TOSCA_META_FILE_VERSION_ENTRY.getName())
- && hasEntry(entries, CSAR_VERSION_ENTRY.getName())
- && hasEntry(entries, CREATED_BY_ENTRY.getName());
+ && hasEntry(entries, CSAR_VERSION_ENTRY.getName())
+ && hasEntry(entries, CREATED_BY_ENTRY.getName());
}
private boolean hasEntry(final Map<String, String> entries, final String mandatoryEntry) {
if (!entries.containsKey(mandatoryEntry)) {
reportError(ErrorLevel.ERROR,
- String.format(Messages.METADATA_MISSING_ENTRY.getErrorMessage(), mandatoryEntry));
+ String.format(Messages.METADATA_MISSING_ENTRY.getErrorMessage(), mandatoryEntry));
return false;
}
return true;
@@ -267,7 +275,7 @@ class SOL004MetaDirectoryValidator implements Validator {
} else {
final String key = (String) entry.getKey();
reportError(ErrorLevel.ERROR,
- String.format(Messages.MANIFEST_INVALID_PNF_METADATA.getErrorMessage(), key));
+ String.format(Messages.MANIFEST_INVALID_PNF_METADATA.getErrorMessage(), key));
}
}
@@ -275,9 +283,9 @@ class SOL004MetaDirectoryValidator implements Validator {
private void verifyMetadataEntryVersions(final String key, final String version) {
if (!(isValidTOSCAVersion(key, version) || isValidCSARVersion(key, version)
- || CREATED_BY_ENTRY.getName().equals(key))) {
+ || CREATED_BY_ENTRY.getName().equals(key))) {
errorsByFile.add(new ErrorMessage(ErrorLevel.ERROR,
- String.format(Messages.METADATA_INVALID_VERSION.getErrorMessage(), key, version)));
+ String.format(Messages.METADATA_INVALID_VERSION.getErrorMessage(), key, version)));
LOGGER.error("{}: key {} - value {} ", Messages.METADATA_INVALID_VERSION.getErrorMessage(), key, version);
}
}
@@ -288,7 +296,7 @@ class SOL004MetaDirectoryValidator implements Validator {
private boolean isValidCSARVersion(final String value, final String version) {
return CSAR_VERSION_ENTRY.getName().equals(value) && (CSAR_VERSION_1_1.equals(version)
- || CSAR_VERSION_1_0.equals(version));
+ || CSAR_VERSION_1_0.equals(version));
}
private void validateDefinitionFile(final String filePath) {
@@ -296,7 +304,7 @@ class SOL004MetaDirectoryValidator implements Validator {
if (verifyFileExists(existingFiles, filePath)) {
final ToscaDefinitionImportHandler toscaDefinitionImportHandler =
- new ToscaDefinitionImportHandler(contentHandler.getFiles(), filePath);
+ new ToscaDefinitionImportHandler(contentHandler.getFiles(), filePath);
final List<ErrorMessage> validationErrorList = toscaDefinitionImportHandler.getErrors();
if (CollectionUtils.isNotEmpty(validationErrorList)) {
errorsByFile.addAll(validationErrorList);
@@ -335,8 +343,8 @@ class SOL004MetaDirectoryValidator implements Validator {
private void verifyManifestMetadata(final Map<String, String> metadata) {
if (metadata.size() != MANIFEST_METADATA_LIMIT) {
reportError(ErrorLevel.ERROR,
- String.format(Messages.MANIFEST_METADATA_DOES_NOT_MATCH_LIMIT.getErrorMessage(),
- MANIFEST_METADATA_LIMIT));
+ String.format(Messages.MANIFEST_METADATA_DOES_NOT_MATCH_LIMIT.getErrorMessage(),
+ MANIFEST_METADATA_LIMIT));
}
if (isPnfMetadata(metadata)) {
handleMetadataEntries(metadata, MANIFEST_PNF_METADATA);
@@ -348,9 +356,9 @@ class SOL004MetaDirectoryValidator implements Validator {
private boolean isPnfMetadata(final Map<String, String> metadata) {
final String firstMetadataDefinition = metadata.keySet().iterator().next();
final String expectedMetadataType =
- firstMetadataDefinition.contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF;
+ firstMetadataDefinition.contains(TOSCA_TYPE_PNF) ? TOSCA_TYPE_PNF : TOSCA_TYPE_VNF;
if (metadata.keySet().stream()
- .anyMatch((final String metadataEntry) -> !metadataEntry.contains(expectedMetadataType))) {
+ .anyMatch((final String metadataEntry) -> !metadataEntry.contains(expectedMetadataType))) {
throw new InvalidManifestMetadataException(Messages.MANIFEST_METADATA_INVALID_ENTRY.getErrorMessage());
}
@@ -359,10 +367,10 @@ class SOL004MetaDirectoryValidator implements Validator {
private void handleMetadataEntries(final Map<String, String> metadata, final Set<String> manifestMetadata) {
manifestMetadata.stream()
- .filter(requiredEntry -> !metadata.containsKey(requiredEntry))
- .forEach(requiredEntry ->
- reportError(ErrorLevel.ERROR,
- String.format(Messages.MANIFEST_METADATA_MISSING_ENTRY.getErrorMessage(), requiredEntry)));
+ .filter(requiredEntry -> !metadata.containsKey(requiredEntry))
+ .forEach(requiredEntry ->
+ reportError(ErrorLevel.ERROR,
+ String.format(Messages.MANIFEST_METADATA_MISSING_ENTRY.getErrorMessage(), requiredEntry)));
}
/**
@@ -372,14 +380,14 @@ class SOL004MetaDirectoryValidator implements Validator {
*/
private void verifyManifestSources(final Manifest onboardingManifest) {
final Set<String> packageFiles = contentHandler.getFileList();
- final List<String> sources = filterSources(onboardingManifest.getSources());
+ final List<String> sources = internalFilesFilter.filter(onboardingManifest.getSources());
verifyFilesExist(packageFiles, sources, MANIFEST_SOURCE);
final Map<String, List<String>> nonManoArtifacts = onboardingManifest.getNonManoSources();
final List<String> nonManoValidFilePaths = new ArrayList<>();
nonManoArtifacts.forEach((nonManoType, files) -> {
- final List<String> internalNonManoFileList = filterSources(files);
+ final List<String> internalNonManoFileList = internalFilesFilter.filter(files);
nonManoValidFilePaths.addAll(internalNonManoFileList);
final NonManoArtifactType nonManoArtifactType = NonManoArtifactType.parse(nonManoType).orElse(null);
if (nonManoArtifactType == ONAP_PM_DICTIONARY || nonManoArtifactType == ONAP_VES_EVENTS) {
@@ -404,24 +412,24 @@ class SOL004MetaDirectoryValidator implements Validator {
}
if (files.size() != 1) {
final String formattedFileList = files.stream()
- .map(filePath -> String.format("'%s'", filePath))
- .collect(Collectors.joining(", "));
+ .map(filePath -> String.format("'%s'", filePath))
+ .collect(Collectors.joining(", "));
reportError(ErrorLevel.ERROR,
- Messages.UNIQUE_SW_INFORMATION_NON_MANO_ERROR.formatMessage(formattedFileList));
+ Messages.UNIQUE_SW_INFORMATION_NON_MANO_ERROR.formatMessage(formattedFileList));
return;
}
final String swInformationFilePath = files.get(0);
final byte[] swInformationYaml = contentHandler.getFileContent(swInformationFilePath);
final Optional<PnfSoftwareInformation> parsedYaml = SoftwareInformationArtifactYamlParser
- .parse(swInformationYaml);
- if(!parsedYaml.isPresent()) {
+ .parse(swInformationYaml);
+ if (!parsedYaml.isPresent()) {
reportError(ErrorLevel.ERROR,
- Messages.INVALID_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
+ Messages.INVALID_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
} else {
final PnfSoftwareInformation pnfSoftwareInformation = parsedYaml.get();
if (!pnfSoftwareInformation.isValid()) {
reportError(ErrorLevel.ERROR,
- Messages.INCORRECT_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
+ Messages.INCORRECT_SW_INFORMATION_NON_MANO_ERROR.formatMessage(swInformationFilePath));
}
}
}
@@ -469,29 +477,19 @@ class SOL004MetaDirectoryValidator implements Validator {
packageFileSet.forEach(filePath -> {
if (!isManifestFile(filePath) && !referredFileSet.contains(filePath)) {
reportError(ErrorLevel.ERROR,
- String.format(Messages.MISSING_MANIFEST_REFERENCE.getErrorMessage(), filePath));
+ String.format(Messages.MISSING_MANIFEST_REFERENCE.getErrorMessage(), filePath));
}
});
}
-
+
private boolean isManifestFile(final String filePath) {
return filePath.equals(toscaMetadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName()));
}
- private List<String> filterSources(final List<String> source) {
- return source.stream()
- .filter(this::externalFileReferences)
- .collect(Collectors.toList());
- }
-
- private boolean externalFileReferences(final String filePath) {
- return !filePath.contains("://");
- }
-
private void validateOtherEntries(final String folderPath) {
if (!verifyFoldersExist(folderList, folderPath)) {
reportError(ErrorLevel.ERROR, String.format(Messages.METADATA_MISSING_OPTIONAL_FOLDERS.getErrorMessage(),
- folderPath));
+ folderPath));
}
}
@@ -499,7 +497,7 @@ class SOL004MetaDirectoryValidator implements Validator {
final Set<String> packageFiles = contentHandler.getFileList();
if (!verifyFileExist(packageFiles, file)) {
reportError(ErrorLevel.ERROR,
- String.format(Messages.MISSING_METADATA_FILES.getErrorMessage(), file, file));
+ String.format(Messages.MISSING_METADATA_FILES.getErrorMessage(), file, file));
}
}
@@ -511,7 +509,7 @@ class SOL004MetaDirectoryValidator implements Validator {
sources.forEach(file -> {
if (!existingFiles.contains(file)) {
reportError(ErrorLevel.ERROR,
- String.format(Messages.MISSING_MANIFEST_SOURCE.getErrorMessage(), type, file));
+ String.format(Messages.MISSING_MANIFEST_SOURCE.getErrorMessage(), type, file));
}
});
}
@@ -538,4 +536,15 @@ class SOL004MetaDirectoryValidator implements Validator {
errors.put(SdcCommon.UPLOAD_FILE, errorsByFile);
return errors;
}
+
+ private void validatePMDictionaryContentsAgainstSchema() {
+ final Stream<byte[]> pmDictionaryFiles = new FileExtractor(getEtsiEntryManifestPath(), contentHandler)
+ .findFiles(ONAP_PM_DICTIONARY);
+ new PMDictionaryValidator()
+ .validate(pmDictionaryFiles, (String message) -> reportError(ErrorLevel.ERROR, message));
+ }
+
+ private String getEtsiEntryManifestPath() {
+ return toscaMetadata.getMetaEntries().get(ETSI_ENTRY_MANIFEST.getName());
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java
new file mode 100644
index 0000000000..c6d7d637fa
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractor.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.openecomp.sdc.be.config.NonManoArtifactType;
+import org.openecomp.sdc.tosca.csar.Manifest;
+import org.openecomp.sdc.tosca.csar.SOL004ManifestOnboarding;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.OnboardingPackageContentHandler;
+
+public class FileExtractor {
+
+ private final InternalFilesFilter internalFilesFilter;
+ private final String etsiEntryManifestFilePath;
+ private final OnboardingPackageContentHandler contentHandler;
+
+ public FileExtractor(String etsiEntryManifestPath, OnboardingPackageContentHandler contentHandler) {
+ this(etsiEntryManifestPath, contentHandler, new InternalFilesFilter());
+ }
+
+ FileExtractor(String etsiEntryManifestPath, OnboardingPackageContentHandler contentHandler, InternalFilesFilter internalFilesFilter) {
+ this.etsiEntryManifestFilePath = etsiEntryManifestPath;
+ this.contentHandler = contentHandler;
+ this.internalFilesFilter = internalFilesFilter;
+ }
+
+ public Stream<byte[]> findFiles(NonManoArtifactType fileType) {
+ Map<String, List<String>> nonManoSources = extractNonManoSources();
+ List<String> pathsToSources = nonManoSources.getOrDefault(fileType.getType(), new ArrayList<>());
+ List<String> pathsToLocalFiles = internalFilesFilter.filter(pathsToSources);
+ return pathsToLocalFiles.stream()
+ .map(contentHandler::getFileContent);
+ }
+
+ private Map<String, List<String>> extractNonManoSources() {
+ Manifest onboardingManifest = new SOL004ManifestOnboarding();
+ onboardingManifest.parse(contentHandler.getFileContentAsStream(etsiEntryManifestFilePath));
+ return onboardingManifest.getNonManoSources();
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java
new file mode 100644
index 0000000000..50dcd0ce29
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilter.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.utils;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+public class InternalFilesFilter {
+
+ public List<String> filter(final List<String> sources) {
+ return sources.stream()
+ .filter(this::isInternalFile)
+ .collect(Collectors.toList());
+ }
+
+ private boolean isInternalFile(final String filePath) {
+ return !filePath.contains("://");
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidatorTest.java
new file mode 100644
index 0000000000..22ef7720dc
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/PMDictionaryValidatorTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.openecomp.sdc.be.test.util.TestResourcesHandler.getResourceBytesOrFail;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+import org.junit.jupiter.api.Test;
+
+class PMDictionaryValidatorTest {
+
+ @Test
+ void shouldReportNoErrors_whenPmDictionaryIsValid() {
+ // given
+ List<String> errors = new ArrayList<>();
+ final byte[] pmDictionaryContent = getResourceBytesOrFail(
+ "validation.files/measurements/pmEvents-valid.yaml");
+
+ // when
+ new PMDictionaryValidator().validate(Stream.of(pmDictionaryContent), errors::add);
+
+ // then
+ assertTrue(errors.isEmpty());
+ }
+
+ @Test
+ void shouldReportErrors_whenPmDictionaryIsInvalid() {
+ // given
+ List<String> errors = new ArrayList<>();
+ final byte[] pmDictionaryContent = getResourceBytesOrFail(
+ "validation.files/measurements/pmEvents-invalid.yaml");
+
+ // when
+ new PMDictionaryValidator().validate(Stream.of(pmDictionaryContent), errors::add);
+
+ // then
+ assertThat(errors.size(), is(1));
+ assertThat(errors.get(0), is("Key not found: pmDictionaryHeader"));
+ }
+
+ @Test
+ void shouldReportEmptyYamlMessage_whenPmDictionaryIsEmpty() {
+ // given
+ List<String> errors = new ArrayList<>();
+ final byte[] pmDictionaryContent = "".getBytes();
+
+ // when
+ new PMDictionaryValidator().validate(Stream.of(pmDictionaryContent), errors::add);
+
+ // then
+ assertThat(errors.size(), is(1));
+ assertThat(errors.get(0), is("PM_Dictionary YAML file is empty"));
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java
index d6ff7022c3..dca4ecfce5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/SOL004MetaDirectoryValidatorTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications copyright (c) 2020 Nokia
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -90,17 +92,17 @@ public class SOL004MetaDirectoryValidatorTest {
sol004MetaDirectoryValidator = new SOL004MetaDirectoryValidator();
handler = new OnboardingPackageContentHandler();
metaFileBuilder = new StringBuilder()
- .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
+ .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" 1.0").append("\n")
- .append(CSAR_VERSION_ENTRY.getName())
+ .append(CSAR_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" 1.1").append("\n")
- .append(CREATED_BY_ENTRY.getName())
+ .append(CREATED_BY_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Vendor").append("\n")
- .append(ENTRY_DEFINITIONS.getName())
+ .append(ENTRY_DEFINITIONS.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_DEFINITION_FILEPATH).append("\n")
- .append(ETSI_ENTRY_MANIFEST.getName())
+ .append(ETSI_ENTRY_MANIFEST.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_MANIFEST_FILEPATH).append("\n")
- .append(ETSI_ENTRY_CHANGE_LOG.getName())
+ .append(ETSI_ENTRY_CHANGE_LOG.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_CHANGELOG_FILEPATH).append("\n");
}
@@ -125,9 +127,9 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFolder("Files/Tests/");
handler.addFolder("Files/Licenses/");
metaFileBuilder
- .append(ETSI_ENTRY_TESTS.getName())
+ .append(ETSI_ENTRY_TESTS.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(entryTestFilePath).append("\n")
- .append(ETSI_ENTRY_LICENSES.getName())
+ .append(ETSI_ENTRY_LICENSES.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(entryLicenseFilePath).append("\n");
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
@@ -140,13 +142,13 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(entryLicenseFilePath, "".getBytes());
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder()
- .withSource(TOSCA_META_PATH_FILE_NAME)
- .withSource(TOSCA_DEFINITION_FILEPATH)
- .withSource(TOSCA_CHANGELOG_FILEPATH)
- .withSource(TOSCA_MANIFEST_FILEPATH).withSource(SAMPLE_SOURCE)
- .withSource(SAMPLE_DEFINITION_IMPORT_FILE_PATH)
- .withSource(entryTestFilePath)
- .withSource(entryLicenseFilePath);
+ .withSource(TOSCA_META_PATH_FILE_NAME)
+ .withSource(TOSCA_DEFINITION_FILEPATH)
+ .withSource(TOSCA_CHANGELOG_FILEPATH)
+ .withSource(TOSCA_MANIFEST_FILEPATH).withSource(SAMPLE_SOURCE)
+ .withSource(SAMPLE_DEFINITION_IMPORT_FILE_PATH)
+ .withSource(entryTestFilePath)
+ .withSource(entryLicenseFilePath);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
@@ -157,7 +159,7 @@ public class SOL004MetaDirectoryValidatorTest {
@Test
public void testGivenTOSCAMeta_withUnsupportedEntry_thenNoErrorIsReturned() {
metaFileBuilder
- .append("a-unknown-entry")
+ .append("a-unknown-entry")
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ")
.append("Definitions/events.log");
@@ -165,10 +167,10 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
handler.addFile(TOSCA_CHANGELOG_FILEPATH, "".getBytes(StandardCharsets.UTF_8));
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder()
- .withSource(TOSCA_META_PATH_FILE_NAME)
- .withSource(TOSCA_DEFINITION_FILEPATH)
- .withSource(TOSCA_CHANGELOG_FILEPATH)
- .withSource(TOSCA_MANIFEST_FILEPATH);
+ .withSource(TOSCA_META_PATH_FILE_NAME)
+ .withSource(TOSCA_DEFINITION_FILEPATH)
+ .withSource(TOSCA_CHANGELOG_FILEPATH)
+ .withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
@@ -181,17 +183,17 @@ public class SOL004MetaDirectoryValidatorTest {
@Test
public void testGivenTOSCAMetaFile_withInvalidTOSCAMetaFileVersionAndCSARVersion_thenErrorIsReturned() {
final StringBuilder metaFileBuilder = new StringBuilder()
- .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
+ .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(Integer.MAX_VALUE).append("\n")
- .append(CSAR_VERSION_ENTRY.getName())
+ .append(CSAR_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(Integer.MAX_VALUE).append("\n")
- .append(CREATED_BY_ENTRY.getName())
+ .append(CREATED_BY_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Vendor").append("\n")
- .append(ENTRY_DEFINITIONS.getName())
+ .append(ENTRY_DEFINITIONS.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_DEFINITION_FILEPATH).append("\n")
- .append(ETSI_ENTRY_MANIFEST.getName())
+ .append(ETSI_ENTRY_MANIFEST.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_MANIFEST_FILEPATH).append("\n")
- .append(ETSI_ENTRY_CHANGE_LOG.getName())
+ .append(ETSI_ENTRY_CHANGE_LOG.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_CHANGELOG_FILEPATH);
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder();
@@ -236,7 +238,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(SAMPLE_SOURCE);
handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml",
- getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
+ getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
manifestBuilder.withSource("Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml");
final String definitionFileWithValidImports = "validation.files/definition/definitionFileWithValidImports.yaml";
@@ -263,18 +265,18 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(SAMPLE_SOURCE, "".getBytes());
manifestBuilder.withSource(SAMPLE_SOURCE);
- final byte [] sampleDefinitionFile1 =
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile1.yaml");
+ final byte[] sampleDefinitionFile1 =
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile1.yaml");
handler.addFile(TOSCA_DEFINITION_FILEPATH, sampleDefinitionFile1);
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
- final byte [] sampleDefinitionFile2 =
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml");
+ final byte[] sampleDefinitionFile2 =
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml");
handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml", sampleDefinitionFile2);
manifestBuilder.withSource("Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml");
- final byte [] sampleDefinitionFile3 =
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile1.yaml");
+ final byte[] sampleDefinitionFile3 =
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile1.yaml");
handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml", sampleDefinitionFile3);
manifestBuilder.withSource("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml");
@@ -299,7 +301,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(SAMPLE_SOURCE);
final String definitionFileWithInvalidImports =
- "validation.files/definition/definitionFileWithInvalidImport.yaml";
+ "validation.files/definition/definitionFileWithInvalidImport.yaml";
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytesOrFail(definitionFileWithInvalidImports));
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
@@ -332,7 +334,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
handler.addFile(TOSCA_DEFINITION_FILEPATH,
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
@@ -340,7 +342,7 @@ public class SOL004MetaDirectoryValidatorTest {
final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Manifest referenced import file missing", errors, 1);
}
-
+
@Test
public void testGivenDefinitionFile_whenFileInPackageNotInManifest_thenErrorIsReturned() {
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder();
@@ -353,21 +355,21 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(SAMPLE_SOURCE, "".getBytes());
- final byte [] sampleDefinitionFile =
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml");
+ final byte[] sampleDefinitionFile =
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml");
handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml", sampleDefinitionFile);
manifestBuilder.withSource("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml");
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
handler.addFile(TOSCA_DEFINITION_FILEPATH,
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Artifact is not being referenced in manifest file", errors, 1);
}
-
+
@Test
public void testGivenDefinitionFile_whenManifestNotreferencedInManifest_thenNoErrorIsReturned() {
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder();
@@ -381,14 +383,14 @@ public class SOL004MetaDirectoryValidatorTest {
handler.addFile(SAMPLE_SOURCE, "".getBytes());
manifestBuilder.withSource(SAMPLE_SOURCE);
- final byte [] sampleDefinitionFile =
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml");
+ final byte[] sampleDefinitionFile =
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml");
handler.addFile("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml", sampleDefinitionFile);
manifestBuilder.withSource("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml");
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
handler.addFile(TOSCA_DEFINITION_FILEPATH,
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
@@ -501,7 +503,7 @@ public class SOL004MetaDirectoryValidatorTest {
}
@Test
- public void testGivenManifestAndDefinitionFile_withSameNames_thenNoErrorReturned() {
+ public void testGivenManifestAndDefinitionFile_withSameNames_thenNoErrorReturned() {
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder();
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
@@ -529,17 +531,17 @@ public class SOL004MetaDirectoryValidatorTest {
@Test
public void testGivenManifestAndMainDefinitionFile_withDifferentNames_thenErrorIsReturned() {
metaFileBuilder = new StringBuilder()
- .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
+ .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" 1.0").append("\n")
- .append(CSAR_VERSION_ENTRY.getName())
+ .append(CSAR_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" 1.1").append("\n")
- .append(CREATED_BY_ENTRY.getName())
+ .append(CREATED_BY_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Vendor").append("\n")
- .append(ENTRY_DEFINITIONS.getName())
+ .append(ENTRY_DEFINITIONS.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_DEFINITION_FILEPATH).append("\n")
- .append(ETSI_ENTRY_MANIFEST.getName())
+ .append(ETSI_ENTRY_MANIFEST.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Definitions/MainServiceTemplate2.mf\n")
- .append(ETSI_ENTRY_CHANGE_LOG.getName())
+ .append(ETSI_ENTRY_CHANGE_LOG.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_CHANGELOG_FILEPATH).append("\n");
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder();
@@ -561,23 +563,23 @@ public class SOL004MetaDirectoryValidatorTest {
final Map<String, List<ErrorMessage>> errors = sol004MetaDirectoryValidator.validateContent(handler);
assertExpectedErrors("Main TOSCA definitions file and Manifest file with different name should return error",
- errors, 1);
+ errors, 1);
}
@Test
public void testGivenManifestFile_withDifferentExtension_thenErrorIsReturned() {
metaFileBuilder = new StringBuilder()
- .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
+ .append(TOSCA_META_FILE_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" 1.0").append("\n")
- .append(CSAR_VERSION_ENTRY.getName())
+ .append(CSAR_VERSION_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" 1.1").append("\n")
- .append(CREATED_BY_ENTRY.getName())
+ .append(CREATED_BY_ENTRY.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Vendor").append("\n")
- .append(ENTRY_DEFINITIONS.getName())
+ .append(ENTRY_DEFINITIONS.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_DEFINITION_FILEPATH).append("\n")
- .append(ETSI_ENTRY_MANIFEST.getName())
+ .append(ETSI_ENTRY_MANIFEST.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Definitions/MainServiceTemplate.txt\n")
- .append(ETSI_ENTRY_CHANGE_LOG.getName())
+ .append(ETSI_ENTRY_CHANGE_LOG.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(TOSCA_CHANGELOG_FILEPATH).append("\n");
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder();
@@ -631,7 +633,7 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_CHANGELOG_FILEPATH);
manifestBuilder.withSignedSource(TOSCA_DEFINITION_FILEPATH
- , "SHA-abc", "09e5a788acb180162c51679ae4c998039fa6644505db2415e35107d1ee213943");
+ , "SHA-abc", "09e5a788acb180162c51679ae4c998039fa6644505db2415e35107d1ee213943");
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
@@ -647,10 +649,10 @@ public class SOL004MetaDirectoryValidatorTest {
@Test
public void testGivenManifestFile_withMetadataContainingMixedPnfVnfMetadata_thenErrorIsReturned() {
final ManifestBuilder manifestBuilder = new ManifestBuilder()
- .withMetaData(PNFD_NAME.getToken(), "RadioNode")
- .withMetaData(VNF_PROVIDER_ID.getToken(), "Bilal Iqbal")
- .withMetaData(PNFD_ARCHIVE_VERSION.getToken(), "1.0")
- .withMetaData(VNF_RELEASE_DATE_TIME.getToken(), "2019-12-14T11:25:00+00:00");
+ .withMetaData(PNFD_NAME.getToken(), "RadioNode")
+ .withMetaData(VNF_PROVIDER_ID.getToken(), "Bilal Iqbal")
+ .withMetaData(PNFD_ARCHIVE_VERSION.getToken(), "1.0")
+ .withMetaData(VNF_RELEASE_DATE_TIME.getToken(), "2019-12-14T11:25:00+00:00");
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
@@ -670,10 +672,10 @@ public class SOL004MetaDirectoryValidatorTest {
@Test
public void testGivenManifestFile_withMetadataMissingPnfOrVnfMandatoryEntries_thenErrorIsReturned() {
final ManifestBuilder manifestBuilder = new ManifestBuilder()
- .withMetaData("invalid_product_name", "RadioNode")
- .withMetaData("invalid_provider_id", "Bilal Iqbal")
- .withMetaData("invalid_package_version", "1.0")
- .withMetaData("invalid_release_date_time", "2019-12-14T11:25:00+00:00");
+ .withMetaData("invalid_product_name", "RadioNode")
+ .withMetaData("invalid_provider_id", "Bilal Iqbal")
+ .withMetaData("invalid_package_version", "1.0")
+ .withMetaData("invalid_release_date_time", "2019-12-14T11:25:00+00:00");
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
@@ -744,10 +746,10 @@ public class SOL004MetaDirectoryValidatorTest {
@Test
public void testGivenManifestFile_withMetadataEntriesExceedingTheLimit_thenErrorIsReturned() {
final ManifestBuilder manifestBuilder = getVnfManifestSampleBuilder()
- .withMetaData(PNFD_NAME.getToken(), "RadioNode")
- .withMetaData(ManifestTokenType.PNFD_PROVIDER.getToken(), "Bilal Iqbal")
- .withMetaData(PNFD_ARCHIVE_VERSION.getToken(), "1.0")
- .withMetaData(PNFD_RELEASE_DATE_TIME.getToken(), "2019-03-11T11:25:00+00:00");
+ .withMetaData(PNFD_NAME.getToken(), "RadioNode")
+ .withMetaData(ManifestTokenType.PNFD_PROVIDER.getToken(), "Bilal Iqbal")
+ .withMetaData(PNFD_ARCHIVE_VERSION.getToken(), "1.0")
+ .withMetaData(PNFD_RELEASE_DATE_TIME.getToken(), "2019-03-11T11:25:00+00:00");
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
@@ -769,9 +771,9 @@ public class SOL004MetaDirectoryValidatorTest {
public void testGivenManifestFile_withPnfMetadataAndVfEntries_thenErrorIsReturned() {
final ManifestBuilder manifestBuilder = getPnfManifestSampleBuilder();
metaFileBuilder
- .append(ETSI_ENTRY_TESTS.getName())
+ .append(ETSI_ENTRY_TESTS.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Files/Tests").append("\n")
- .append(ETSI_ENTRY_LICENSES.getName())
+ .append(ETSI_ENTRY_LICENSES.getName())
.append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" Files/Licenses");
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
@@ -808,7 +810,7 @@ public class SOL004MetaDirectoryValidatorTest {
final String definitionImportOne = "Definitions/importOne.yaml";
handler.addFile(definitionImportOne,
- getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
+ getResourceBytesOrFail("validation.files/definition/sampleDefinitionFile2.yaml"));
manifestBuilder.withSource(definitionImportOne);
final String definitionFileWithValidImports = "validation.files/definition/definitionFileWithOneImport.yaml";
@@ -822,7 +824,7 @@ public class SOL004MetaDirectoryValidatorTest {
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.MISSING_IMPORT_FILE.formatMessage("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml"))
+ , Messages.MISSING_IMPORT_FILE.formatMessage("Definitions/etsi_nfv_sol001_pnfd_2_5_2_types.yaml"))
);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
@@ -846,7 +848,7 @@ public class SOL004MetaDirectoryValidatorTest {
final String definitionImportOne = "Definitions/importOne.yaml";
handler.addFile(definitionImportOne,
- getResourceBytesOrFail("validation.files/definition/definitionFileWithInvalidImport.yaml"));
+ getResourceBytesOrFail("validation.files/definition/definitionFileWithInvalidImport.yaml"));
manifestBuilder.withSource(definitionImportOne);
final String definitionFileWithValidImports = "validation.files/definition/definitionFileWithOneImport.yaml";
@@ -860,7 +862,7 @@ public class SOL004MetaDirectoryValidatorTest {
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.INVALID_IMPORT_STATEMENT.formatMessage(definitionImportOne, "null"))
+ , Messages.INVALID_IMPORT_STATEMENT.formatMessage(definitionImportOne, "null"))
);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
@@ -881,19 +883,19 @@ public class SOL004MetaDirectoryValidatorTest {
final String nonManoPmEventsSource = "Artifacts/Deployment/Measurements/PM_Dictionary.yaml";
handler.addFile(nonManoPmEventsSource,
- getResourceBytesOrFail("validation.files/measurements/pmEvents-valid.yaml"));
+ getResourceBytesOrFail("validation.files/measurements/pmEvents-valid.yaml"));
manifestBuilder.withNonManoArtifact(ONAP_PM_DICTIONARY.getType(), nonManoPmEventsSource);
final String nonManoVesEventsSource = "Artifacts/Deployment/Events/ves_events.yaml";
handler.addFile(nonManoVesEventsSource,
- getResourceBytesOrFail("validation.files/events/vesEvents-valid.yaml"));
+ getResourceBytesOrFail("validation.files/events/vesEvents-valid.yaml"));
manifestBuilder.withNonManoArtifact(ONAP_VES_EVENTS.getType(), nonManoVesEventsSource);
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
handler.addFile(TOSCA_MANIFEST_FILEPATH, manifestBuilder.build().getBytes(StandardCharsets.UTF_8));
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler);
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), Collections.emptyList());
}
@@ -920,19 +922,27 @@ public class SOL004MetaDirectoryValidatorTest {
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.INVALID_YAML_FORMAT_1.formatMessage(nonManoPmEventsSource, "while scanning a simple key\n"
- + " in 'reader', line 2, column 1:\n"
- + " key {}\n"
- + " ^\n"
- + "could not find expected ':'\n"
- + " in 'reader', line 2, column 7:\n"
- + " {}\n"
- + " ^\n"))
+ , Messages.INVALID_YAML_FORMAT_1.formatMessage(nonManoPmEventsSource, "while scanning a simple key\n"
+ + " in 'reader', line 2, column 1:\n"
+ + " key {}\n"
+ + " ^\n"
+ + "could not find expected ':'\n"
+ + " in 'reader', line 2, column 7:\n"
+ + " {}\n"
+ + " ^\n"))
+ );
+ expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR, "while scanning a simple key\n" +
+ " in 'reader', line 2, column 1:\n" +
+ " key {}\n" +
+ " ^\n" +
+ "could not find expected ':'\n" +
+ " in 'reader', line 2, column 7:\n" +
+ " {}\n" +
+ " ^\n")
);
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler);
-
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -962,14 +972,17 @@ public class SOL004MetaDirectoryValidatorTest {
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.EMPTY_YAML_FILE_1.formatMessage(nonManoPmEventsSource))
+ , Messages.EMPTY_YAML_FILE_1.formatMessage(nonManoPmEventsSource))
);
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.EMPTY_YAML_FILE_1.formatMessage(nonManoVesEventsSource))
+ , Messages.EMPTY_YAML_FILE_1.formatMessage(nonManoVesEventsSource))
+ );
+ expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
+ , "PM_Dictionary YAML file is empty")
);
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler);
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -1000,14 +1013,18 @@ public class SOL004MetaDirectoryValidatorTest {
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.INVALID_YAML_EXTENSION.formatMessage(nonManoPmEventsSource))
+ , Messages.INVALID_YAML_EXTENSION.formatMessage(nonManoPmEventsSource))
+ );
+ expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
+ , Messages.INVALID_YAML_EXTENSION.formatMessage(nonManoVesEventsSource))
);
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.INVALID_YAML_EXTENSION.formatMessage(nonManoVesEventsSource))
+ , "PM_Dictionary YAML file is empty")
);
+
final Map<String, List<ErrorMessage>> actualErrorMap = sol004MetaDirectoryValidator
- .validateContent(handler);
+ .validateContent(handler);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -1018,10 +1035,10 @@ public class SOL004MetaDirectoryValidatorTest {
final ManifestBuilder manifestBuilder = getPnfManifestSampleBuilder();
final String nonManoSoftwareInformationPath = "Artifacts/software-information/pnf-sw-information-valid.yaml";
handler.addFile(nonManoSoftwareInformationPath,
- getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-valid.yaml"));
+ getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-valid.yaml"));
manifestBuilder.withNonManoArtifact(ONAP_SW_INFORMATION.getType(), nonManoSoftwareInformationPath);
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString()
- .getBytes(StandardCharsets.UTF_8));
+ .getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
@@ -1042,10 +1059,10 @@ public class SOL004MetaDirectoryValidatorTest {
final ManifestBuilder manifestBuilder = getPnfManifestSampleBuilder();
final String nonManoSoftwareInformationPath = "Artifacts/software-information/pnf-sw-information-valid.yaml";
handler.addFile(nonManoSoftwareInformationPath,
- getResourceBytesOrFail("validation.files/invalid.yaml"));
+ getResourceBytesOrFail("validation.files/invalid.yaml"));
manifestBuilder.withNonManoArtifact(ONAP_SW_INFORMATION.getType(), nonManoSoftwareInformationPath);
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString()
- .getBytes(StandardCharsets.UTF_8));
+ .getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
@@ -1059,7 +1076,7 @@ public class SOL004MetaDirectoryValidatorTest {
//then invalid error returned
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.INVALID_SW_INFORMATION_NON_MANO_ERROR.formatMessage(nonManoSoftwareInformationPath))
+ , Messages.INVALID_SW_INFORMATION_NON_MANO_ERROR.formatMessage(nonManoSoftwareInformationPath))
);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -1070,10 +1087,10 @@ public class SOL004MetaDirectoryValidatorTest {
final ManifestBuilder manifestBuilder = getPnfManifestSampleBuilder();
final String nonManoSoftwareInformationPath = "Artifacts/software-information/pnf-sw-information-invalid.yaml";
handler.addFile(nonManoSoftwareInformationPath,
- getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-invalid.yaml"));
+ getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-invalid.yaml"));
manifestBuilder.withNonManoArtifact(ONAP_SW_INFORMATION.getType(), nonManoSoftwareInformationPath);
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString()
- .getBytes(StandardCharsets.UTF_8));
+ .getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
@@ -1087,7 +1104,7 @@ public class SOL004MetaDirectoryValidatorTest {
//then incorrect error returned
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.INCORRECT_SW_INFORMATION_NON_MANO_ERROR.formatMessage(nonManoSoftwareInformationPath))
+ , Messages.INCORRECT_SW_INFORMATION_NON_MANO_ERROR.formatMessage(nonManoSoftwareInformationPath))
);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -1098,14 +1115,14 @@ public class SOL004MetaDirectoryValidatorTest {
final ManifestBuilder manifestBuilder = getPnfManifestSampleBuilder();
final String nonManoSoftwareInformation1Path = "Artifacts/software-information/pnf-sw-information-valid1.yaml";
handler.addFile(nonManoSoftwareInformation1Path,
- getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-valid.yaml"));
+ getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-valid.yaml"));
manifestBuilder.withNonManoArtifact(ONAP_SW_INFORMATION.getType(), nonManoSoftwareInformation1Path);
final String nonManoSoftwareInformation2Path = "Artifacts/software-information/pnf-sw-information-valid2.yaml";
handler.addFile(nonManoSoftwareInformation2Path,
- getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-valid.yaml"));
+ getResourceBytesOrFail("validation.files/non-mano/pnf-sw-information-valid.yaml"));
manifestBuilder.withNonManoArtifact(ONAP_SW_INFORMATION.getType(), nonManoSoftwareInformation2Path);
handler.addFile(TOSCA_META_PATH_FILE_NAME, metaFileBuilder.toString()
- .getBytes(StandardCharsets.UTF_8));
+ .getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
handler.addFile(TOSCA_DEFINITION_FILEPATH, getResourceBytesOrFail(SAMPLE_DEFINITION_FILE_PATH));
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
@@ -1119,10 +1136,10 @@ public class SOL004MetaDirectoryValidatorTest {
//then unique error returned
final List<ErrorMessage> expectedErrorList = new ArrayList<>();
final String errorFiles = Stream.of(nonManoSoftwareInformation1Path, nonManoSoftwareInformation2Path)
- .map(s -> String.format("'%s'", s))
- .collect(Collectors.joining(", "));
+ .map(s -> String.format("'%s'", s))
+ .collect(Collectors.joining(", "));
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.UNIQUE_SW_INFORMATION_NON_MANO_ERROR.formatMessage(errorFiles))
+ , Messages.UNIQUE_SW_INFORMATION_NON_MANO_ERROR.formatMessage(errorFiles))
);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
@@ -1146,9 +1163,9 @@ public class SOL004MetaDirectoryValidatorTest {
manifestBuilder.withSource(TOSCA_DEFINITION_FILEPATH);
metaFileBuilder.append(ETSI_ENTRY_CERTIFICATE.getName())
- .append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(fakeCertificatePath).append("\n");
+ .append(ATTRIBUTE_VALUE_SEPARATOR.getToken()).append(" ").append(fakeCertificatePath).append("\n");
handler.addFile(TOSCA_META_PATH_FILE_NAME,
- metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
+ metaFileBuilder.toString().getBytes(StandardCharsets.UTF_8));
manifestBuilder.withSource(TOSCA_META_PATH_FILE_NAME);
manifestBuilder.withSource(TOSCA_MANIFEST_FILEPATH);
@@ -1173,32 +1190,30 @@ public class SOL004MetaDirectoryValidatorTest {
//then
List<ErrorMessage> expectedErrorList = new ArrayList<>();
expectedErrorList.add(new ErrorMessage(ErrorLevel.ERROR
- , Messages.ARTIFACT_INVALID_SIGNATURE.formatMessage(fakeArtifactCmsPath, fakeArtifactPath))
+ , Messages.ARTIFACT_INVALID_SIGNATURE.formatMessage(fakeArtifactCmsPath, fakeArtifactPath))
);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
//given
sol004MetaDirectoryValidator = new SOL004MetaDirectoryValidator(securityManagerMock);
when(securityManagerMock.verifySignedData(any(), any(), any()))
- .thenThrow(new SecurityManagerException("SecurityManagerException"));
+ .thenThrow(new SecurityManagerException("SecurityManagerException"));
//when
actualErrorMap = sol004MetaDirectoryValidator.validateContent(handler);
//then
expectedErrorList = new ArrayList<>();
expectedErrorList.add(
- new ErrorMessage(ErrorLevel.ERROR,
- Messages.ARTIFACT_SIGNATURE_VALIDATION_ERROR.formatMessage(fakeArtifactCmsPath,
- fakeArtifactPath, fakeCertificatePath, "SecurityManagerException")
- )
+ new ErrorMessage(ErrorLevel.ERROR,
+ Messages.ARTIFACT_SIGNATURE_VALIDATION_ERROR.formatMessage(fakeArtifactCmsPath,
+ fakeArtifactPath, fakeCertificatePath, "SecurityManagerException")
+ )
);
assertExpectedErrors(actualErrorMap.get(SdcCommon.UPLOAD_FILE), expectedErrorList);
}
-
-
- private void assertExpectedErrors(final String testCase, final Map<String, List<ErrorMessage>> errors, final int expectedErrors){
+ private void assertExpectedErrors(final String testCase, final Map<String, List<ErrorMessage>> errors, final int expectedErrors) {
final List<ErrorMessage> errorMessages = errors.get(SdcCommon.UPLOAD_FILE);
printErrorMessages(errorMessages);
if (expectedErrors > 0) {
@@ -1211,25 +1226,25 @@ public class SOL004MetaDirectoryValidatorTest {
private void printErrorMessages(final List<ErrorMessage> errorMessages) {
if (CollectionUtils.isNotEmpty(errorMessages)) {
errorMessages.forEach(errorMessage ->
- System.out.println(String.format("%s: %s", errorMessage.getLevel(), errorMessage.getMessage()))
+ System.out.println(String.format("%s: %s", errorMessage.getLevel(), errorMessage.getMessage()))
);
}
}
private ManifestBuilder getPnfManifestSampleBuilder() {
return new ManifestBuilder()
- .withMetaData(PNFD_NAME.getToken(), "myPnf")
- .withMetaData(ManifestTokenType.PNFD_PROVIDER.getToken(), "ACME")
- .withMetaData(PNFD_ARCHIVE_VERSION.getToken(), "1.0")
- .withMetaData(PNFD_RELEASE_DATE_TIME.getToken(), "2019-03-11T11:25:00+00:00");
+ .withMetaData(PNFD_NAME.getToken(), "myPnf")
+ .withMetaData(ManifestTokenType.PNFD_PROVIDER.getToken(), "ACME")
+ .withMetaData(PNFD_ARCHIVE_VERSION.getToken(), "1.0")
+ .withMetaData(PNFD_RELEASE_DATE_TIME.getToken(), "2019-03-11T11:25:00+00:00");
}
private ManifestBuilder getVnfManifestSampleBuilder() {
return new ManifestBuilder()
- .withMetaData(VNF_PRODUCT_NAME.getToken(), "RadioNode")
- .withMetaData(VNF_PROVIDER_ID.getToken(), "ACME")
- .withMetaData(VNF_PACKAGE_VERSION.getToken(), "1.0")
- .withMetaData(VNF_RELEASE_DATE_TIME.getToken(), "2019-03-11T11:25:00+00:00");
+ .withMetaData(VNF_PRODUCT_NAME.getToken(), "RadioNode")
+ .withMetaData(VNF_PROVIDER_ID.getToken(), "ACME")
+ .withMetaData(VNF_PACKAGE_VERSION.getToken(), "1.0")
+ .withMetaData(VNF_RELEASE_DATE_TIME.getToken(), "2019-03-11T11:25:00+00:00");
}
private void assertExpectedErrors(List<ErrorMessage> actualErrorList, final List<ErrorMessage> expectedErrorList) {
@@ -1240,12 +1255,12 @@ public class SOL004MetaDirectoryValidatorTest {
printErrorMessages(actualErrorList);
assertThat("The actual error list should have the same size as the expected error list"
- , actualErrorList, hasSize(expectedErrorList.size())
+ , actualErrorList, hasSize(expectedErrorList.size())
);
assertThat("The actual error and expected error lists should be the same"
- , actualErrorList, containsInAnyOrder(expectedErrorList.toArray(new ErrorMessage[0]))
+ , actualErrorList, containsInAnyOrder(expectedErrorList.toArray(new ErrorMessage[0]))
);
}
-} \ No newline at end of file
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractorTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractorTest.java
new file mode 100644
index 0000000000..f50feae620
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/FileExtractorTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.utils;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.openecomp.sdc.be.config.NonManoArtifactType.ONAP_PM_DICTIONARY;
+import static org.openecomp.sdc.be.test.util.TestResourcesHandler.getResourceBytesOrFail;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.onboarding.OnboardingPackageContentHandler;
+
+
+public class FileExtractorTest {
+
+ private static final String PATH_TO_MANIFEST = "/PATH/TO/MANIFEST/";
+ private OnboardingPackageContentHandler contentHandler;
+
+ @BeforeEach
+ public void setUp() throws IOException {
+ contentHandler = new OnboardingPackageContentHandler();
+ }
+
+ @Test
+ void shouldExtractPMDictionaryFiles() {
+ // given
+ final byte[] pmDictionaryContent = "PM_DICTIONARY_CONTENT".getBytes();
+ contentHandler.addFile(PATH_TO_MANIFEST,
+ getResourceBytesOrFail("validation.files/manifest/manifestCompliantWithSOL004.mf"));
+ contentHandler.addFile("Files/Measurements/PM_Dictionary.yaml", pmDictionaryContent);
+
+ // when
+ final List<byte[]> filesContents = new FileExtractor(PATH_TO_MANIFEST, contentHandler)
+ .findFiles(ONAP_PM_DICTIONARY)
+ .collect(Collectors.toList());
+
+ // then
+ assertThat(filesContents.size(), is(1));
+ assertThat(filesContents.get(0), is(pmDictionaryContent));
+ }
+
+ @Test
+ void shouldReturnEmptyStream_whenPmDictionaryIsMissing() {
+ // given
+ contentHandler.addFile(PATH_TO_MANIFEST,
+ getResourceBytesOrFail("validation.files/manifest/sampleManifest2.mf"));
+
+ // when
+ final List<byte[]> filesContents = new FileExtractor(PATH_TO_MANIFEST, contentHandler)
+ .findFiles(ONAP_PM_DICTIONARY)
+ .collect(Collectors.toList());
+
+ // then
+ assertThat(filesContents.size(), is(0));
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilterTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilterTest.java
new file mode 100644
index 0000000000..f402fc1e25
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/validation/utils/InternalFilesFilterTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.validation.utils;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.equalTo;
+
+import java.util.List;
+import org.junit.jupiter.api.Test;
+
+class InternalFilesFilterTest {
+
+ @Test
+ void shouldFilterInternalFiles() {
+ // given
+ List<String> sources = List.of(
+ "http://test.com",
+ "ftp://test.com",
+ "/home/onap"
+ );
+
+ // when
+ final List<String> filteredSources = new InternalFilesFilter().filter(sources);
+
+ // then
+ assertThat(filteredSources, equalTo(List.of("/home/onap")));
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestCompliantWithSOL004.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestCompliantWithSOL004.mf
new file mode 100644
index 0000000000..30fb837497
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/manifest/manifestCompliantWithSOL004.mf
@@ -0,0 +1,27 @@
+metadata:
+ pnfd_name: myPnf
+ pnfd_provider: Acme
+ pnfd_archive_version: 1.0
+ pnfd_release_date_time: 2019-03-11T11:25:00+00:00
+
+Source: pnf_main_descriptor.mf
+Source: Definitions/pnf_main_descriptor.yaml
+Source: Definitions/etsi_nfv_sol001_pnfd_2_5_1_types.yaml
+Source: Definitions/etsi_nfv_sol001_vnfd_2_5_1_types.yaml
+Source: Files/ChangeLog.txt
+Source: Files/Events/MyPnf_Pnf_v1.yaml
+Source: Files/Guides/user_guide.txt
+Source: Files/Measurements/PM_Dictionary.yaml
+Source: Files/Scripts/my_script.sh
+Source: Files/Yang_module/mynetconf.yang
+Source: TOSCA-Metadata/TOSCA.meta
+
+non_mano_artifact_sets:
+ onap_ves_events:
+ Source: Files/Events/MyPnf_Pnf_v1.yaml
+ onap_pm_dictionary:
+ Source: Files/Measurements/PM_Dictionary.yaml
+ onap_yang_modules:
+ Source: Files/Yang_module/mynetconf.yang
+ onap_others:
+ Source: Files/Guides/user_guide.txt \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-invalid.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-invalid.yaml
new file mode 100644
index 0000000000..e9ab911da3
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-invalid.yaml
@@ -0,0 +1,175 @@
+pmDictionary:
+ presence: required
+ structure:
+ pmDictionaryHeader:
+ presence: required
+ structure:
+ pmDefVsn: { presence: required, comment: "Version of the PM Dictionary. Version is vendor defined."}
+ pmDefSchemaVsn: { presence: required, comment: "Version of the PM Dictionary Schema used for this PM Dictionary. Schema versions are specified in the VES Specifications."}
+ nfType: { presence: required, comment: "NF type to whom this PM Dictionary applies. nfType is vendor defined and should match the string used in eventName."}
+ vendor: { presence: required, value: Acme, comment: "Vendor of the NF type to whom this PM Dictionary applies."}
+ pmDictionaryMeasurements:
+ presence: required
+ array:
+ - measType: { presence: required, comment: "Measurement name used in PM file, in 3GPP format where specified, else vendor defined. Names for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item e). Names for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item e). Vendor defined names are preceded with VS."}
+ measDescription: { presence: required, comment: "Text description of the purpose of the measurement, what information does the measurement provide. Descriptions for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item a). Descriptions for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item a). Vendors are free to augment or modify the 3GPP-provided descriptions to more accurately describe their measurements as needed."}
+ measCondition: { presence: required, comment: "Text description of the condition that causes the measurement to be updated. Conditions for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item c). Conditions for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item c). Vendors are free to augment or modify the 3GPP-provided conditions to more accurately describe their measurements as needed."}
+ measResultType: { presence: required, value: [integer], comment: "Data type of the measurement result. Result data types for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item d). Result data types for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item d). The measResultType values supported by a vendor are specified in the PM Dictionary YAML using the 'value' attribute and may include vendor-defined data types not specified by 3GPP; for example boolean."}
+ measResultRange: { presence: optional, comment: "Range for the measurement result. The range is specified as a comma separated list of discrete values or a range of values specified as minimum value-maximum value with no spaces. Result ranges for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item d) if applicable. Result ranges for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item d) if applicable. "}
+ measResultUnits: { presence: required, value: [seconds, minutes, nanoseconds, microseconds, kbps], comment: "Unit of measure for the result; e.g. milliseconds, bytes, kilobytes, packets, number. Unit of measure for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item d) if applicable. Unit of measure for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item d) if applicable. The measResultsUnits values supported by a vendor are specified in the PM Dictionary YAML using the 'value' attribute and may include vendor-defined units of measure not specified by 3GPP; for example ethernet frames."}
+ measObjClass: { presence: required, value: [NRCellCU, NRCellDU, NRBTS, IPNO, ETHIF], comment: "Measurement Object Class. Object classes for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item f). Object classes for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item f). The measObjClass values supported by a vendor are specified in the PM Dictionary YAML using the “value” attribute and may include vendor-defined objects not specified by 3GPP; for example IPSEC."}
+ measCollectionMethod: { presence: required, value: [CC, GUAGE, DER, SI], comment: "Collection Method for the measurement. 3GPP-defined collection methods are CC, SI, DER and Gauge. Collection Methods for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 item b). Collection Methods for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 item c). The measCollectionMethod values supported by a vendor are specified in the PM Dictionary YAML using the 'value' attribute and may include vendor-defined collection methods not specified by 3GPP; for example Average."}
+ measLastChange: { presence: required, comment: "PM Dictionary version the last time this measurement was changed, added or deleted."}
+ measChangeType: { presence: required, value: [added, modified, deleted], comment: "For the measLastChange, indicates the type of change made for this measurement. Valid values are added, modified or deleted. Deleted measurements may be kept in the PM Dictionary for one release or more or permanently for historical purposes, if desired."}
+ measInfoId: { presence: required, comment: "Name for a group of related measurements, in 3GPP format where specified, else vendor defined. Family names for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 Section 3.1. Family names for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 Section 3.4."}
+ measFamily: { presence: required, comment: "Abbreviation for a family of measurements, in 3GPP format where specified, else vendor defined. Family name abbreviations for 3GPP-defined 4G measurements are specified in 3GPP TS 32.425 Section 3.1. Family name abbreviations for 3GPP-defined 5G measurements are specified in 3GPP TS 28.552 Section 3.4. "}
+ measAdditionalFields: { presence: required, comment: "Hashmap of vendor specific PM Dictionary fields in key value pair format.", structure: {
+ keyValuePair: { presence: required, structure: { key: { presence: required, value: measurementStatus, comment: "Contains the status of the measurement."}, value: { presence: required, value: [USED, DEPRECATED, OBSOLETE, PRELIMINARY] }}},
+ keyValuePair: { presence: required, structure: { key: { presence: required, value: initialValue, comment: "The initial value to which the Measurement Type is set at the beginning of a new granularity period."}, value: { presence: required }}},
+ keyValuePair: { presence: required, structure: { key: { presence: required, value: acmeParameter1, comment: "Extra vendor specific parameter 1."}, value: { presence: required }}},
+ keyValuePair: { presence: optional, structure: { key: { presence: required, value: acmeParameter2, comment: "Extra vendor specific parameter 2."}, value: { presence: required, value: [true, false] }}},
+ keyValuePair: { presence: optional, structure: { key: { presence: required, value: acmeParameter3, comment: "Extra vendor specific parameter 3."}, value: { presence: required }}}}
+ }
+---
+pmDictionary:
+ pmDictionaryMeasurements:
+ - measType: DRB.UEThpDl
+ measDescription: Average DL UE throughput in gNB
+ measCondition: See 3GPP TS 28.552
+ measResultType: integer
+ measResultRange: 0-4294967295
+ measResultUnits: kbps
+ measObjClass: NRCellDU
+ measCollectionMethod: DER
+ measLastChange: 1.0
+ measChangeType: added
+ measInfoId: "Data Radio Bearer"
+ measFamily: DRB
+ measAdditionalFields: {
+ "measurementStatus": "USED",
+ "initialValue": 0,
+ "acmeParameter1": 0,
+ "acmeParameter2": true,
+ "acmeParameter3": "acmeParameterValue3"}
+ - measType: VS.ifInDiscards
+ measDescription: The number of inbound packets which were chosen to be discarded
+ measCondition: The number of inbound packets which were chosen to be
+ discarded even though no errors had been detected to prevent
+ their being deliverable to a higher-layer protocol. One
+ possible reason for discarding such a packet could be to
+ free up buffer space.
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ measResultType: integer
+ measResultRange: 0-4294967295
+ measResultUnits: number
+ measObjClass: EthernetPort
+ measCollectionMethod: CC
+ measLastChange: 1.0
+ measChangeType: added
+ measInfoId: "IP Management"
+ measFamily: IP
+ measAdditionalFields: {
+ "measurementStatus": "USED",
+ "initialValue": 0,
+ "acmeParameter1": 0,
+ "acmeParameter2": true,
+ "acmeParameter3": "acmeParameterValue3"}
+ - measType: VS.ifInErrors
+ measDescription: Number of inbound packets that contained errors
+ measCondition: For packet-oriented interfaces, the number of inbound
+ packets that contained errors preventing them from being
+ deliverable to a higher-layer protocol. For character-
+ oriented or fixed-length interfaces, the number of inbound
+ transmission units that contained errors preventing them
+ from being deliverable to a higher-layer protocol.
+ measResultType: integer
+ measResultRange: 0-4294967295
+ measResultUnits: number
+ measObjClass: EthernetPort
+ measCollectionMethod: Gauge
+ measLastChange: 1.0
+ measChangeType: added
+ measInfoId: "IP Management"
+ measFamily: IP
+ measAdditionalFields: {
+ "measurementStatus": "USED",
+ "initialValue": 0,
+ "acmeParameter1": 0,
+ "acmeParameter3": "acmeParameterValue3"}
+ - measType: VS.ifInUnknownProtos
+ measDescription: Number of inbound packets received via an unknown or usupported protocol
+ measCondition: For packet-oriented interfaces, the number of packets
+ received via the interface which were discarded because of
+ an unknown or unsupported protocol. For character-oriented
+ or fixed-length interfaces that support protocol
+ multiplexing the number of transmission units received via
+ the interface which were discarded because of an unknown or
+ unsupported protocol. For any interface that does not
+ support protocol multiplexing, this counter will always be
+ 0.
+ measResultType: integer
+ measResultRange: 0-4294967295
+ measResultUnits: number
+ measObjClass: EthernetPort
+ measCollectionMethod: CC
+ measLastChange: 1.0
+ measChangeType: added
+ measInfoId: "IP Management"
+ measFamily: IP
+ measAdditionalFields: {
+ "measurementStatus": "USED",
+ "initialValue": 0,
+ "acmeParameter1": 0,
+ "acmeParameter2": true}
+ - measType: VS.ifHCInBroadcastPkts
+ measDescription: Number of the broadcasted inbound packets delivered to the higher (sub-)layer
+ measCondition: The number of packets, delivered by this sub-layer to a
+ higher (sub-)layer, which were addressed to a broadcast
+ address at this sub-layer. This object is a 64-bit version
+ of ifInBroadcastPkts.
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ measResultType: integer
+ measResultRange: 0-4294967295
+ measResultUnits: number
+ measObjClass: EthernetPort
+ measCollectionMethod: CC
+ measLastChange: 1.0
+ measChangeType: added
+ measInfoId: "IP Management"
+ measFamily: IP
+ measAdditionalFields: {
+ "measurementStatus": "USED",
+ "initialValue": 0,
+ "acmeParameter1": 0}
+ - measType: VS.ifHCOutBroadcastPkts
+ measDescription: Number of the broadcasted outsbound packets delivered to the higher (sub-)layer
+ measCondition: The total number of packets that higher-level protocols
+ requested be transmitted, and which were addressed to a
+ broadcast address at this sub-layer, including those that
+ were discarded or not sent. This object is a 64-bit version
+ of ifOutBroadcastPkts.
+ Discontinuities in the value of this counter can occur at
+ re-initialization of the management system, and at other
+ times as indicated by the value of
+ ifCounterDiscontinuityTime.
+ measResultType: integer
+ measResultRange: 0-4294967295
+ measResultUnits: number
+ measObjClass: EthernetPort
+ measCollectionMethod: CC
+ measLastChange: 1.0
+ measChangeType: added
+ measInfoId: "IP Management"
+ measFamily: IP
+ measAdditionalFields: {
+ "measurementStatus": "USED",
+ "initialValue": 0,
+ "acmeParameter1": 0,
+ "acmeParameter2": true,
+ "acmeParameter3": "acmeParameterValue3"} \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-valid.yaml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-valid.yaml
index 858951f7b0..d5d9fa63f5 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-valid.yaml
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/validation.files/measurements/pmEvents-valid.yaml
@@ -38,7 +38,6 @@ pmDictionary:
nfType: myPnf
vendor: Acme
pmDictionaryMeasurements:
-
- measType: DRB.UEThpDl
measDescription: Average DL UE throughput in gNB
measCondition: See 3GPP TS 28.552
@@ -57,7 +56,6 @@ pmDictionary:
"acmeParameter1": 0,
"acmeParameter2": true,
"acmeParameter3": "acmeParameterValue3"}
-
- measType: VS.ifInDiscards
measDescription: The number of inbound packets which were chosen to be discarded
measCondition: The number of inbound packets which were chosen to be
@@ -84,7 +82,6 @@ pmDictionary:
"acmeParameter1": 0,
"acmeParameter2": true,
"acmeParameter3": "acmeParameterValue3"}
-
- measType: VS.ifInErrors
measDescription: Number of inbound packets that contained errors
measCondition: For packet-oriented interfaces, the number of inbound
@@ -107,7 +104,6 @@ pmDictionary:
"initialValue": 0,
"acmeParameter1": 0,
"acmeParameter3": "acmeParameterValue3"}
-
- measType: VS.ifInUnknownProtos
measDescription: Number of inbound packets received via an unknown or usupported protocol
measCondition: For packet-oriented interfaces, the number of packets
@@ -133,7 +129,6 @@ pmDictionary:
"initialValue": 0,
"acmeParameter1": 0,
"acmeParameter2": true}
-
- measType: VS.ifHCInBroadcastPkts
measDescription: Number of the broadcasted inbound packets delivered to the higher (sub-)layer
measCondition: The number of packets, delivered by this sub-layer to a
@@ -157,7 +152,6 @@ pmDictionary:
"measurementStatus": "USED",
"initialValue": 0,
"acmeParameter1": 0}
-
- measType: VS.ifHCOutBroadcastPkts
measDescription: Number of the broadcasted outsbound packets delivered to the higher (sub-)layer
measCondition: The total number of packets that higher-level protocols
@@ -183,4 +177,4 @@ pmDictionary:
"initialValue": 0,
"acmeParameter1": 0,
"acmeParameter2": true,
- "acmeParameter3": "acmeParameterValue3"}
+ "acmeParameter3": "acmeParameterValue3"} \ No newline at end of file