aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-validation-lib
diff options
context:
space:
mode:
authorAdam Wudzinski <adam.wudzinski@nokia.com>2020-11-27 12:50:27 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2020-12-02 12:59:56 +0000
commitad99b805537fc8f3103fa5646abe5342924e10cd (patch)
tree266fbadbef9ea2412455b907e9ac688f9e746d60 /openecomp-be/lib/openecomp-sdc-validation-lib
parente7f2dfba0cb4d917c8da83c319b47ae279a6151e (diff)
[SDC] PM_Dictionary file validation for ZIP onboarding
Use PM_Dictionary validator from VNF-SDK to validate PM_Dictionary files when onboarding ZIP package Issue-ID: SDC-3390 Signed-off-by: Adam Wudzinski <adam.wudzinski@nokia.com> Change-Id: I03fd622393d675977527b9845b6cf8b87b2ec0a3
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-validation-lib')
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json4
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml11
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtils.java55
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java94
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtilsTest.java111
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java60
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/invalid_pm_dictionary.yaml228
-rw-r--r--openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/valid_pm_dictionary.yaml230
9 files changed, 798 insertions, 4 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json
index 9e4a2e0d4d..75fd84c574 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-core/src/main/resources/config-validaton.json
@@ -4,6 +4,10 @@
"enable": true,
"implementationClass": "org.openecomp.sdc.validation.impl.validators.SharedResourceGuideLineValidator"
},
+ "pmDictionaryValidator": {
+ "enable": true,
+ "implementationClass": "org.openecomp.sdc.validation.impl.validators.PmDictionaryValidator"
+ },
"forbiddenResourceGuideLineValidator": {
"enable": true,
"implementationClass": "org.openecomp.sdc.validation.impl.validators.ForbiddenResourceGuideLineValidator",
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml
index 5ce053c8e3..2119ee8108 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/pom.xml
@@ -1,5 +1,6 @@
<!--
~ Copyright © 2016-2018 European Support Limited
+ ~ Copyright © 2020 Nokia
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
@@ -78,6 +79,16 @@
<artifactId>openecomp-sdc-validation-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.vnfsdk.validation</groupId>
+ <artifactId>validation-pmdictionary</artifactId>
+ <version>${onap.vnfsdk.validation.pmdictionary.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.vavr</groupId>
+ <artifactId>vavr</artifactId>
+ <version>${io.vavr.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtils.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtils.java
new file mode 100644
index 0000000000..c49062acc0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtils.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. 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.validation.impl.validators;
+
+import java.util.Set;
+
+class FileExtensionUtils {
+
+ private static final Set<String> VALID_PM_DICTIONARY_EXTENSIONS = Set.of(
+ "pmdict.yml",
+ "pmdict.yaml",
+ "pm_dict.yml",
+ "pm_dict.yaml",
+ "pmdictionary.yml",
+ "pmdictionary.yaml",
+ "pm_dictionary.yml",
+ "pm_dictionary.yaml"
+ );
+ private static final Set<String> VALID_YAML_EXTENSIONS = Set.of(
+ ".yaml",
+ ".yml",
+ ".env"
+ );
+
+ static boolean isYaml(String fileName) {
+ return isValidExt(fileName, VALID_YAML_EXTENSIONS);
+ }
+
+ static boolean isPmDictionary(String fileName) {
+ return isValidExt(fileName, VALID_PM_DICTIONARY_EXTENSIONS);
+ }
+
+ private static boolean isValidExt(String fileName, Set<String> validExtensions) {
+ String fileNameLower = fileName.toLowerCase();
+ return validExtensions.stream()
+ .anyMatch(fileNameLower::endsWith);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java
new file mode 100644
index 0000000000..f5338c5d3b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidator.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. 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.validation.impl.validators;
+
+import io.vavr.control.Option;
+import io.vavr.control.Try;
+import java.io.InputStream;
+import java.util.List;
+import org.onap.validation.yaml.YamlContentValidator;
+import org.onap.validation.yaml.error.YamlDocumentValidationError;
+import org.openecomp.core.validation.ErrorMessageCode;
+import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
+import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.validation.Validator;
+
+public class PmDictionaryValidator implements Validator {
+
+ private static final ErrorMessageCode PM_DICT_ERROR_CODE = new ErrorMessageCode("PM_DICT");
+
+ @Override
+ public void validate(GlobalValidationContext globalContext) {
+ globalContext.getFiles().stream()
+ .filter(FileExtensionUtils::isPmDictionary)
+ .map(fileName -> new ValidationHelper(globalContext, fileName))
+ .forEach(ValidationHelper::validate);
+ }
+
+ private static class ValidationHelper {
+
+ private final GlobalValidationContext globalContext;
+ private final String fileName;
+
+ private ValidationHelper(GlobalValidationContext globalContext, String fileName) {
+ this.globalContext = globalContext;
+ this.fileName = fileName;
+ }
+
+ public void validate() {
+ Option.ofOptional(globalContext.getFileContent(fileName))
+ .peek(this::validateFileContent)
+ .onEmpty(() -> addErrorToContext(formatMessage("File is empty")));
+ }
+
+ private void validateFileContent(InputStream inputStream) {
+ Try.of(inputStream::readAllBytes)
+ .mapTry(fileContent -> new YamlContentValidator().validate(fileContent))
+ .onSuccess(this::reportValidationErrorsIfPresent)
+ .onFailure(e -> addErrorToContext(formatMessage(e.getMessage())));
+ }
+
+ private void reportValidationErrorsIfPresent(List<YamlDocumentValidationError> validationErrors) {
+ validationErrors.stream()
+ .map(this::prepareValidationMessage)
+ .forEach(this::addErrorToContext);
+ }
+
+ private String prepareValidationMessage(YamlDocumentValidationError error) {
+ final String errorMessage = String.format("Document Number: %s, Path: %s, Problem: %s",
+ error.getYamlDocumentNumber(),
+ error.getPath(),
+ error.getMessage()
+ );
+ return formatMessage(errorMessage);
+ }
+
+ private String formatMessage(String message) {
+ return ErrorMessagesFormatBuilder
+ .getErrorWithParameters(PM_DICT_ERROR_CODE, message);
+ }
+
+ private void addErrorToContext(String message) {
+ globalContext.addMessage(fileName, ErrorLevel.ERROR, message);
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java
index fba39e063e..4196ad2929 100644
--- a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/main/java/org/openecomp/sdc/validation/impl/validators/YamlValidator.java
@@ -1,5 +1,6 @@
/*
* Copyright © 2016-2017 European Support Limited
+ * Copyright © 2020 Nokia
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,15 +38,15 @@ public class YamlValidator implements Validator {
@Override
public void validate(GlobalValidationContext globalContext) {
Collection<String> files = globalContext.files(
- (fileName, globalValidationContext) -> fileName.endsWith(".yaml")
- || fileName.endsWith(".yml") || fileName.endsWith(".env"));
+ (fileName, globalValidationContext) -> FileExtensionUtils.isYaml(fileName)
+ && !FileExtensionUtils.isPmDictionary(fileName));
- files.stream().forEach(fileName -> validate(fileName, globalContext));
+ files.forEach(fileName -> validate(fileName, globalContext));
}
private void validate(String fileName, GlobalValidationContext globalContext) {
Optional<InputStream> rowContent = globalContext.getFileContent(fileName);
- if (!rowContent.isPresent()) {
+ if (rowContent.isEmpty()) {
globalContext.addMessage(fileName, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
.getErrorWithParameters(ERROR_CODE_YML_1, Messages
.INVALID_YAML_FORMAT_REASON.getErrorMessage(),
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtilsTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtilsTest.java
new file mode 100644
index 0000000000..53a2cfa650
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/FileExtensionUtilsTest.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. 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.validation.impl.validators;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import org.junit.jupiter.api.Test;
+
+class FileExtensionUtilsTest {
+
+ private static final Set<String> VALID_YAML_EXTENSIONS = Set.of(
+ ".yaml",
+ ".yml",
+ ".env"
+ );
+ private static final Set<String> INVALID_YAML_EXTENSIONS = Set.of(
+ ".txt",
+ ".java",
+ ".properties"
+ );
+
+ private static final Set<String> VALID_PM_DICTIONARY_EXTENSIONS = Set.of(
+ "pmdict.yml",
+ "pmdict.yaml",
+ "pm_dict.yml",
+ "pm_dict.yaml",
+ "pmdictionary.yml",
+ "pmdictionary.yaml",
+ "pm_dictionary.yml",
+ "pm_dictionary.yaml"
+ );
+ private static final Set<String> INVALID_PM_DICTIONARY_EXTENSIONS = Set.of(
+ "pmdict.txt",
+ "pmdict.java",
+ "pm.yml"
+ );
+
+ private static final Set<String> TEST_FILE_PREFIXES = Set.of(
+ "test",
+ "test_file"
+ );
+
+ @Test
+ void shouldMatchProperYamlExtensions() {
+ final boolean allValidFilesMatched = constructTestFilenamesWithExtensions(VALID_YAML_EXTENSIONS)
+ .allMatch(FileExtensionUtils::isYaml);
+
+ assertTrue(allValidFilesMatched);
+ }
+
+ @Test
+ void shouldNotMatchImproperYamlExtensions() {
+ final boolean allInvalidFilesNotMatched = constructTestFilenamesWithExtensions(INVALID_YAML_EXTENSIONS)
+ .noneMatch(FileExtensionUtils::isYaml);
+
+ assertTrue(allInvalidFilesNotMatched);
+ }
+
+ @Test
+ void shouldMatchProperPmDictionaryExtensions() {
+ final boolean allValidFilesMatched = constructTestFilenamesWithExtensions(VALID_PM_DICTIONARY_EXTENSIONS)
+ .allMatch(FileExtensionUtils::isPmDictionary);
+
+ assertTrue(allValidFilesMatched);
+ }
+
+ @Test
+ void shouldNotMatchImproperPmDictionaryExtensions() {
+ final boolean allInvalidFilesNotMatched = constructTestFilenamesWithExtensions(INVALID_PM_DICTIONARY_EXTENSIONS)
+ .noneMatch(FileExtensionUtils::isPmDictionary);
+
+ assertTrue(allInvalidFilesNotMatched);
+ }
+
+ private Stream<String> constructTestFilenamesWithExtensions(Set<String> extensions) {
+ return extensions.stream()
+ .flatMap(ext -> prepareFilenamesWithExtension(ext).stream());
+ }
+
+ private Set<String> prepareFilenamesWithExtension(String extension) {
+ return Stream.concat(
+ joinTestNamesWithExtension(extension.toLowerCase()),
+ joinTestNamesWithExtension(extension.toUpperCase())
+ ).collect(Collectors.toSet());
+ }
+
+ private Stream<String> joinTestNamesWithExtension(String extension) {
+ return TEST_FILE_PREFIXES.stream()
+ .map(prefix -> prefix + extension);
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java
new file mode 100644
index 0000000000..d841694a23
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/java/org/openecomp/sdc/validation/impl/validators/PmDictionaryValidatorTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. 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.validation.impl.validators;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+import java.util.Map;
+import org.junit.jupiter.api.Test;
+import org.openecomp.core.validation.types.MessageContainer;
+import org.openecomp.sdc.validation.util.ValidationTestUtil;
+
+public class PmDictionaryValidatorTest {
+
+ private static final String RESOURCE_PATH = "/org/openecomp/validation/validators/pm_dictionary_validator";
+ private static final String VALID_PM_DICTIONARY_YAML = "valid_pm_dictionary.yaml";
+ private static final String INVALID_PM_DICTIONARY_YAML = "invalid_pm_dictionary.yaml";
+
+ @Test
+ public void shouldNotReturnErrorsWhenValidPmDict() {
+ Map<String, MessageContainer> messages = runValidation(
+ RESOURCE_PATH + "/" + VALID_PM_DICTIONARY_YAML);
+
+ assertNotNull(messages);
+ assertEquals(0, messages.size());
+ }
+
+ @Test
+ public void shouldReturnErrorsWhenInvalidPmDict() {
+ Map<String, MessageContainer> messages = runValidation(
+ RESOURCE_PATH + "/" + INVALID_PM_DICTIONARY_YAML);
+
+ assertNotNull(messages);
+ assertNotNull(messages.get(INVALID_PM_DICTIONARY_YAML));
+ assertEquals(4, messages.get(INVALID_PM_DICTIONARY_YAML).getErrorMessageList().size());
+ }
+
+ private Map<String, MessageContainer> runValidation(String path) {
+ PmDictionaryValidator validator = new PmDictionaryValidator();
+ return ValidationTestUtil.testValidator(validator, path);
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/invalid_pm_dictionary.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/invalid_pm_dictionary.yaml
new file mode 100644
index 0000000000..cfeb497eeb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/invalid_pm_dictionary.yaml
@@ -0,0 +1,228 @@
+---
+# PM Dictionary schema specifying and describing the meta information
+# used to define perf3gpp measurements in the PM Dictionary
+pmMetaData:
+ presence: required
+ structure:
+ pmHeader:
+ presence: required
+ structure:
+ nfType:
+ presence: required
+ comment: NF type; should match the nfName-vendor string used in the fileReady
+ or perf3gpp eventName
+ pmDefSchemaVsn:
+ presence: required
+ value: 2.0
+ comment: PM Dictionary Schema Version from the VES Event Registration specification
+ pmDefVsn:
+ presence: required
+ comment: vendor-defined PM Dictionary version
+ pmFields:
+ presence: required
+ structure:
+ iMeasInfoId:
+ presence: required
+ comment: vendor-defined integer measurement group identifier
+ iMeasType:
+ presence: required
+ comment: vendor-defined integer identifier for the measType; must be combined
+ with measInfoId to identify a specific measurement.
+ measChangeType:
+ presence: required
+ value:
+ - added
+ - modified
+ - deleted
+ comment: indicates the type of change that occurred during measLastChange
+ measCollectionMethod:
+ presence: required
+ value:
+ - CC
+ - SI
+ - DER
+ - Gauge
+ - Average
+ comment: the measurement collection method; CC, SI, DER and Gauge are as
+ defined in 3GPP; average contains the average value of the measurement
+ during the granularity period
+ measCondition:
+ presence: required
+ comment: description of the condition causing the measurement
+ measDescription:
+ presence: required
+ comment: description of the measurement information and purpose
+ measFamily:
+ presence: required
+ comment: abbreviation for a family of measurements, in 3GPP format, or vendor
+ defined
+ measInfoId:
+ presence: required
+ comment: name for a group of related measurements in 3GPP format or vendor
+ defined
+ measLastChange:
+ presence: required
+ comment: version of the PM Dictionary the last time this measurement was
+ added, modified or deleted
+ measObjClass:
+ presence: required
+ value:
+ - NGBTS
+ - NGCELL
+ - IPNO
+ - IPSEC
+ - ETHIF
+ comment: measurement object class
+ measResultRange:
+ presence: optional
+ comment: range of the measurement result; only necessary when the range
+ is smaller than the full range of the data type
+ measResultType:
+ presence: required
+ value:
+ - float
+ - uint32
+ - uint64
+ comment: data type of the measurement result
+ measResultUnits:
+ presence: required
+ value:
+ - seconds
+ - minutes
+ - nanoseconds
+ - microseconds
+ - dB
+ - number
+ - kilobytes
+ - bytes
+ - ethernetFrames
+ - packets
+ - users
+ comment: units of measure for the measurement result
+ measType:
+ presence: required
+ comment: measurement name in 3GPP or vendor-specific format; vendor specific
+ names are preceded with VS
+ measAdditionalFields:
+ presence: required
+ comment: vendor-specific PM Dictionary fields
+ structure:
+ vendorField1:
+ presence: required
+ value:
+ - X
+ - Y
+ - Z
+ comment: vendor field 1 description
+ vendorField2:
+ presence: optional
+ value:
+ - A
+ - B
+ comment: vendor field 2 description.
+...
+# PM Dictionary perf3gpp measurements for the gnb-Nokia NF (bracket style yaml)
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2204
+ iMeasType: 1
+ measCollectionMethod: CC
+ measCondition: "This measurement is updated when X2AP: SgNB Modification Required message is sent to MeNB
+ with the SCG Change Indication set as PSCellChange."
+ measDescription: "This counter indicates the number of intra gNB intra frequency PSCell change attempts."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G18A_1807_003
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: integer
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChAttempt
+ measAdditionalFields:
+ vendorField1: X
+ vendorField2: B
+...
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2204
+ iMeasType: 2
+ measCollectionMethod: CC
+ measCondition: "This measurement is updated when the TDCoverall timer has elapsed before gNB receives the X2AP: SgNB Modification Confirm message."
+ measDescription: "This measurement the number of intra gNB intra frequency PSCell change failures due to TDCoverall timer expiry."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G18A_1807_003
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: float
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChFailTdcExp
+ measAdditionalFields:
+ vendorField1:
+ - Y
+ - X
+...
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2206
+ iMeasType: 1
+ measCondition: "This measurement is updated when MeNB replies to X2AP: SgNB Modification Required message with the X2AP: SgNB Modification Refuse message."
+ measCollectionMethod: CC
+ measDescription: "This counter indicates the number of intra gNB intra frequency PSCell change failures due to MeNB refusal."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G19_1906_002
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: float
+ measChangeType: added
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChFailMenbRef
+ measAdditionalFields:
+ vendorField1:
+ - Z
+ - A
+ vendorField2: A
+...
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2206
+ iMeasType: 1
+ measCondition: "This measurement is updated when MeNB replies to X2AP: SgNB Modification Required message with the X2AP: SgNB Modification Refuse message."
+ measCollectionMethod: CC
+ measDescription: "This counter indicates the number of intra gNB intra frequency PSCell change failures due to MeNB refusal."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G19_1906_002
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: float
+ measChangeType: added
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChFailMenbRef
+ measAdditionalFields:
+ vendorField1:
+ - X
+ - Y
+ vendorField2: A
+...
diff --git a/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/valid_pm_dictionary.yaml b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/valid_pm_dictionary.yaml
new file mode 100644
index 0000000000..1caab5fc73
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-validation-lib/openecomp-sdc-validation-impl/src/test/resources/org/openecomp/validation/validators/pm_dictionary_validator/valid_pm_dictionary.yaml
@@ -0,0 +1,230 @@
+---
+# PM Dictionary schema specifying and describing the meta information
+# used to define perf3gpp measurements in the PM Dictionary
+pmMetaData:
+ presence: required
+ structure:
+ pmHeader:
+ presence: required
+ structure:
+ nfType:
+ presence: required
+ comment: NF type; should match the nfName-vendor string used in the fileReady
+ or perf3gpp eventName
+ pmDefSchemaVsn:
+ presence: required
+ value: 2.0
+ comment: PM Dictionary Schema Version from the VES Event Registration specification
+ pmDefVsn:
+ presence: required
+ comment: vendor-defined PM Dictionary version
+ pmFields:
+ presence: required
+ structure:
+ iMeasInfoId:
+ presence: required
+ comment: vendor-defined integer measurement group identifier
+ iMeasType:
+ presence: required
+ comment: vendor-defined integer identifier for the measType; must be combined
+ with measInfoId to identify a specific measurement.
+ measChangeType:
+ presence: required
+ value:
+ - added
+ - modified
+ - deleted
+ comment: indicates the type of change that occurred during measLastChange
+ measCollectionMethod:
+ presence: required
+ value:
+ - CC
+ - SI
+ - DER
+ - Gauge
+ - Average
+ comment: the measurement collection method; CC, SI, DER and Gauge are as
+ defined in 3GPP; average contains the average value of the measurement
+ during the granularity period
+ measCondition:
+ presence: required
+ comment: description of the condition causing the measurement
+ measDescription:
+ presence: required
+ comment: description of the measurement information and purpose
+ measFamily:
+ presence: required
+ comment: abbreviation for a family of measurements, in 3GPP format, or vendor
+ defined
+ measInfoId:
+ presence: required
+ comment: name for a group of related measurements in 3GPP format or vendor
+ defined
+ measLastChange:
+ presence: required
+ comment: version of the PM Dictionary the last time this measurement was
+ added, modified or deleted
+ measObjClass:
+ presence: required
+ value:
+ - NGBTS
+ - NGCELL
+ - IPNO
+ - IPSEC
+ - ETHIF
+ comment: measurement object class
+ measResultRange:
+ presence: optional
+ comment: range of the measurement result; only necessary when the range
+ is smaller than the full range of the data type
+ measResultType:
+ presence: required
+ value:
+ - float
+ - uint32
+ - uint64
+ comment: data type of the measurement result
+ measResultUnits:
+ presence: required
+ value:
+ - seconds
+ - minutes
+ - nanoseconds
+ - microseconds
+ - dB
+ - number
+ - kilobytes
+ - bytes
+ - ethernetFrames
+ - packets
+ - users
+ comment: units of measure for the measurement result
+ measType:
+ presence: required
+ comment: measurement name in 3GPP or vendor-specific format; vendor specific
+ names are preceded with VS
+ measAdditionalFields:
+ presence: required
+ comment: vendor-specific PM Dictionary fields
+ structure:
+ vendorField1:
+ presence: required
+ value:
+ - X
+ - Y
+ - Z
+ comment: vendor field 1 description
+ vendorField2:
+ presence: optional
+ value:
+ - A
+ - B
+ comment: vendor field 2 description.
+...
+# PM Dictionary perf3gpp measurements for the gnb-Nokia NF (bracket style yaml)
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2204
+ iMeasType: 1
+ measCollectionMethod: CC
+ measCondition: "This measurement is updated when X2AP: SgNB Modification Required message is sent to MeNB
+ with the SCG Change Indication set as PSCellChange."
+ measDescription: "This counter indicates the number of intra gNB intra frequency PSCell change attempts."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G18A_1807_003
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: float
+ measChangeType: added
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChAttempt
+ measAdditionalFields:
+ vendorField1: X
+ vendorField2: B
+...
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2204
+ iMeasType: 2
+ measCollectionMethod: CC
+ measCondition: "This measurement is updated when the TDCoverall timer has elapsed before gNB receives the X2AP: SgNB Modification Confirm message."
+ measDescription: "This measurement the number of intra gNB intra frequency PSCell change failures due to TDCoverall timer expiry."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G18A_1807_003
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: float
+ measChangeType: added
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChFailTdcExp
+ measAdditionalFields:
+ vendorField1:
+ - Y
+ - X
+...
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2206
+ iMeasType: 1
+ measCondition: "This measurement is updated when MeNB replies to X2AP: SgNB Modification Required message with the X2AP: SgNB Modification Refuse message."
+ measCollectionMethod: CC
+ measDescription: "This counter indicates the number of intra gNB intra frequency PSCell change failures due to MeNB refusal."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G19_1906_002
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: float
+ measChangeType: added
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChFailMenbRef
+ measAdditionalFields:
+ vendorField1:
+ - X
+ - Y
+ vendorField2: A
+...
+---
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
+ pmDefVsn: 5G19_1906_002
+ pmFields:
+ iMeasInfoId: 2206
+ iMeasType: 1
+ measCondition: "This measurement is updated when MeNB replies to X2AP: SgNB Modification Required message with the X2AP: SgNB Modification Refuse message."
+ measCollectionMethod: CC
+ measDescription: "This counter indicates the number of intra gNB intra frequency PSCell change failures due to MeNB refusal."
+ measFamily: NINFC
+ measInfoId: "NR Intra Frequency PSCell Change"
+ measLastChange: 5G19_1906_002
+ measObjClass: NGCELL
+ measResultRange: 0-4096
+ measResultType: float
+ measChangeType: added
+ measResultUnits: number
+ measType: VS.NINFC.IntraFrPscelChFailMenbRef
+ measAdditionalFields:
+ vendorField1:
+ - X
+ - Z
+ vendorField2: A
+...