summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogumil Zebek <bogumil.zebek@nokia.com>2020-07-15 05:02:55 +0000
committerGerrit Code Review <gerrit@onap.org>2020-07-15 05:02:55 +0000
commit12b638d643a95daa7b3b65835d9781558ad3030a (patch)
tree6796e8a6871375af020eb8cc2950072ff6f6d9a1
parent3c9575672a03092bfe76944329145721e4871cb2 (diff)
parentae6a1ca9e670a9ab2c7302af89f0dd17bf54ba83 (diff)
Merge "Add validation of YAML documents, with use of schema"
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/YamlValidator.java40
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/model/SchemaValidationError.java36
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationProcess.java109
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationStep.java45
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java13
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java9
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java85
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/process/YamlValidationProcessTest.java101
-rw-r--r--csarvalidation/src/test/resources/yaml_schema/Multi_Document_Invalid.yaml86
-rw-r--r--csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml7
10 files changed, 526 insertions, 5 deletions
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/YamlValidator.java b/csarvalidation/src/main/java/org/onap/validation/yaml/YamlValidator.java
new file mode 100644
index 0000000..17ebd1f
--- /dev/null
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/YamlValidator.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+package org.onap.validation.yaml;
+
+import org.onap.validation.yaml.exception.YamlProcessingException;
+import org.onap.validation.yaml.model.SchemaValidationError;
+import org.onap.validation.yaml.model.YamlDocument;
+import org.onap.validation.yaml.process.YamlValidationProcess;
+import org.onap.validation.yaml.schema.YamlSchema;
+
+import java.util.List;
+
+public class YamlValidator {
+
+ private final YamlSchema schema;
+
+ YamlValidator(YamlSchema schema) {
+ this.schema = schema;
+ }
+
+ public List<SchemaValidationError> validate(YamlDocument document) throws YamlProcessingException {
+ return new YamlValidationProcess(schema,document).validate();
+ }
+
+}
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/model/SchemaValidationError.java b/csarvalidation/src/main/java/org/onap/validation/yaml/model/SchemaValidationError.java
new file mode 100644
index 0000000..45f1647
--- /dev/null
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/model/SchemaValidationError.java
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+package org.onap.validation.yaml.model;
+
+public class SchemaValidationError {
+ private final String path;
+ private final String message;
+
+ public String getPath() {
+ return path;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public SchemaValidationError(String path, String message) {
+ this.path = path;
+ this.message = message;
+ }
+}
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationProcess.java b/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationProcess.java
new file mode 100644
index 0000000..f55b729
--- /dev/null
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationProcess.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+package org.onap.validation.yaml.process;
+
+import org.onap.validation.yaml.exception.YamlProcessingException;
+import org.onap.validation.yaml.model.SchemaValidationError;
+import org.onap.validation.yaml.model.YamlDocument;
+import org.onap.validation.yaml.schema.YamlSchema;
+import org.onap.validation.yaml.schema.node.YamlSchemaNode;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+
+public class YamlValidationProcess {
+
+ private final Queue<YamlValidationStep> validationSteps;
+ private final List<SchemaValidationError> errors;
+ private final YamlSchema schema;
+ private final YamlDocument document;
+
+ public YamlValidationProcess(YamlSchema schema, YamlDocument document) {
+ this.schema = schema;
+ this.document = document;
+ errors = new ArrayList<>();
+ validationSteps = new LinkedList<>();
+ }
+
+ public List<SchemaValidationError> validate() throws YamlProcessingException {
+ validationSteps.add(new YamlValidationStep(schema.getRootNodes(), document));
+ while (!validationSteps.isEmpty()) {
+ YamlValidationStep nextValidationNode = validationSteps.poll();
+ validateStep(nextValidationNode);
+ }
+ return errors;
+ }
+
+ private void validateStep(YamlValidationStep validationNode)
+ throws YamlProcessingException {
+ for (YamlSchemaNode schemaNode : validationNode.getSchemaNodes()) {
+ validateNode(validationNode.getDocument(), schemaNode);
+ }
+ }
+
+ private void validateNode(YamlDocument document, YamlSchemaNode schemaNode)
+ throws YamlProcessingException {
+
+ if (document.containsKey(schemaNode.getName())) {
+ if (schemaNode.isContainingSubStructure()) {
+ addNextLevelNodeToValidationNodesQueue(document, schemaNode);
+ } else if (!isValueOfNodeInAcceptedValuesList(document, schemaNode)) {
+ addIncorrectValueError(document, schemaNode);
+ }
+ } else if (schemaNode.isRequired()) {
+ addRequiredKeyNotFoundError(schemaNode);
+ }
+ }
+
+ private boolean isValueOfNodeInAcceptedValuesList(YamlDocument document, YamlSchemaNode node) {
+ return node.getAcceptedValues().isEmpty() ||
+ node.getAcceptedValues().contains(document.getValue(node.getName()));
+ }
+
+ private void addNextLevelNodeToValidationNodesQueue(YamlDocument document, YamlSchemaNode node)
+ throws YamlProcessingException {
+ validationSteps.add(
+ new YamlValidationStep(
+ node.getNextNodes(),
+ document.getSubStructure(node.getName())
+ )
+ );
+ }
+
+ private void addRequiredKeyNotFoundError(YamlSchemaNode node) {
+ errors.add(
+ new SchemaValidationError(
+ node.getPath(),
+ String.format("Key not found: %s", node.getName())
+ )
+ );
+ }
+
+ private void addIncorrectValueError(YamlDocument document, YamlSchemaNode node) {
+ errors.add(
+ new SchemaValidationError(
+ node.getPath() + node.getName(),
+ String.format(
+ "Value is not in array of accepted values.%n value: %s%n accepted values: %s",
+ document.getValue(node.getName()), node.getAcceptedValues())
+ )
+ );
+ }
+}
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationStep.java b/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationStep.java
new file mode 100644
index 0000000..eb5ab8e
--- /dev/null
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationStep.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+package org.onap.validation.yaml.process;
+
+import org.onap.validation.yaml.model.YamlDocument;
+import org.onap.validation.yaml.schema.node.YamlSchemaNode;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+class YamlValidationStep {
+
+ private final List<YamlSchemaNode> schemaNodes;
+ private final YamlDocument document;
+
+ YamlValidationStep(List<YamlSchemaNode> nodes, YamlDocument yaml) {
+ this.schemaNodes = new ArrayList<>(nodes);
+ this.document = yaml;
+ }
+
+ List<YamlSchemaNode> getSchemaNodes() {
+ return Collections.unmodifiableList(schemaNodes);
+ }
+
+ YamlDocument getDocument() {
+ return document;
+ }
+
+}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java
index 1680a40..03999a3 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java
@@ -20,11 +20,12 @@ package org.onap.validation.yaml;
import org.junit.Test;
import org.onap.validation.yaml.model.YamlDocument;
import org.onap.validation.yaml.model.YamlDocumentFactory;
+import org.yaml.snakeyaml.parser.ParserException;
-import java.net.URL;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
public class YamlLoaderTest {
@@ -35,7 +36,15 @@ public class YamlLoaderTest {
List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFile();
// then
- assertThat(documents.size()).isEqualTo(4);
+ assertThat(documents).hasSize(4);
+ }
+
+ @Test
+ public void shouldThrowExceptionWhenLoadingDocumentsFromInvalidYamlFile() {
+ // when then
+ assertThatThrownBy(YamlLoadingUtils::tryToLoadMultiDocumentInvalidYamlFile
+ ).isInstanceOf(ParserException.class)
+ .hasMessageContaining("expected the node content, but found DocumentEnd");
}
}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java
index 1e3618b..5827f66 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java
@@ -28,11 +28,16 @@ public final class YamlLoadingUtils {
private YamlLoadingUtils() {}
+ public static final int VALID_YAML_DOCUMENT_INDEX = 3;
+ public static final int YAML_DOCUMENT_WITH_MISSING_FIELD_INDEX = 2;
+ public static final int YAML_DOCUMENT_WITH_MISSING_FIELD_AND_WRONG_VALUE_INDEX = 1;
+
private static final String PATH_TO_VALID_YAML = "yaml_schema/PM_Dictionary.yaml";
private static final String PATH_TO_SIMPLE_VALID_SCHEMA = "yaml_schema/Simple_Valid_Schema.yaml";
private static final String PATH_TO_SIMPLE_VALID_SCHEMA_MULTI_ROOT = "yaml_schema/Simple_Valid_Schema_Multi_Root.yaml";
private static final String PATH_TO_SIMPLE_INVALID_SCHEMA = "yaml_schema/Simple_Invalid_Schema_Construction.yaml";
private static final String PATH_TO_SIMPLE_INVALID_SCHEMA_FOR_LAZY_LOADING = "yaml_schema/Simple_Invalid_Schema_LazyLoading.yaml";
+ private static final String PATH_TO_MULTI_DOCUMENT_INVALID_YAML = "yaml_schema/Multi_Document_Invalid.yaml";
public static List<YamlDocument> loadValidMultiDocumentYamlFile() throws YamlDocumentParsingException {
return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_VALID_YAML));
@@ -54,6 +59,10 @@ public final class YamlLoadingUtils {
return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_SIMPLE_VALID_SCHEMA_MULTI_ROOT)).get(0);
}
+ public static List<YamlDocument> tryToLoadMultiDocumentInvalidYamlFile() throws YamlDocumentParsingException {
+ return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_MULTI_DOCUMENT_INVALID_YAML));
+ }
+
private static URL getUrlForGivenPath(String path) {
return YamlLoadingUtils.class.getClassLoader().getResource(path);
}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java
new file mode 100644
index 0000000..418ae55
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+package org.onap.validation.yaml;
+
+import org.assertj.core.util.Lists;
+import org.junit.Test;
+import org.onap.validation.yaml.exception.YamlProcessingException;
+import org.onap.validation.yaml.model.SchemaValidationError;
+import org.onap.validation.yaml.model.YamlDocument;
+import org.onap.validation.yaml.schema.YamlSchemaFactory;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.onap.validation.yaml.YamlLoadingUtils.VALID_YAML_DOCUMENT_INDEX;
+import static org.onap.validation.yaml.YamlLoadingUtils.YAML_DOCUMENT_WITH_MISSING_FIELD_INDEX;
+import static org.onap.validation.yaml.YamlLoadingUtils.YAML_DOCUMENT_WITH_MISSING_FIELD_AND_WRONG_VALUE_INDEX;
+
+public class YamlValidatorTest {
+
+ @Test
+ public void shouldCreateValidatorUsingSchemaLoadedFromYamlFileAndValidatedDocumentsFromThatFile()
+ throws YamlProcessingException {
+
+ // given
+ List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFile();
+ YamlValidator validator = new YamlValidator(new YamlSchemaFactory().createTreeStructuredYamlSchema(documents.get(0)));
+ Map<Integer,List<SchemaValidationError>> validationErrors = new HashMap<>();
+
+ SchemaValidationError expectedValidationValueError =
+ new SchemaValidationError(
+ "/pmMetaData/pmFields/measResultType",
+ "Value is not in array of accepted values.\n"
+ + " value: integer\n"
+ + " accepted values: [float, uint32, uint64]"
+ );
+ SchemaValidationError expectedValidationKeyError =
+ new SchemaValidationError(
+ "/pmMetaData/pmFields/",
+ "Key not found: measChangeType"
+ );
+
+ // when
+ for (int documentIndex = 1 ; documentIndex < documents.size() ; documentIndex++) {
+ validationErrors.put(documentIndex, validator.validate(documents.get(documentIndex)));
+ }
+
+ // then
+ assertThat(validationErrors.size()).isEqualTo(3);
+ assertThat(validationErrors).containsKeys(1,2,3);
+ assertThat(validationErrors.get(YAML_DOCUMENT_WITH_MISSING_FIELD_AND_WRONG_VALUE_INDEX)).hasSize(2);
+ assertThat(validationErrors.get(YAML_DOCUMENT_WITH_MISSING_FIELD_AND_WRONG_VALUE_INDEX))
+ .usingFieldByFieldElementComparator()
+ .containsAll(
+ Lists.list(
+ expectedValidationValueError,
+ expectedValidationKeyError
+ ));
+ assertThat(validationErrors.get(YAML_DOCUMENT_WITH_MISSING_FIELD_INDEX)).hasSize(1);
+ assertThat(validationErrors.get(YAML_DOCUMENT_WITH_MISSING_FIELD_INDEX))
+ .usingFieldByFieldElementComparator()
+ .contains(
+ expectedValidationKeyError
+ );
+ assertThat(validationErrors.get(VALID_YAML_DOCUMENT_INDEX)).hasSize(0);
+ }
+
+}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/process/YamlValidationProcessTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/process/YamlValidationProcessTest.java
new file mode 100644
index 0000000..1380a9d
--- /dev/null
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/process/YamlValidationProcessTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+package org.onap.validation.yaml.process;
+
+import org.junit.Test;
+import org.onap.validation.yaml.YamlLoadingUtils;
+import org.onap.validation.yaml.exception.YamlProcessingException;
+import org.onap.validation.yaml.model.SchemaValidationError;
+import org.onap.validation.yaml.model.YamlDocument;
+import org.onap.validation.yaml.schema.YamlSchema;
+import org.onap.validation.yaml.schema.YamlSchemaFactory;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.onap.validation.yaml.YamlLoadingUtils.VALID_YAML_DOCUMENT_INDEX;
+import static org.onap.validation.yaml.YamlLoadingUtils.YAML_DOCUMENT_WITH_MISSING_FIELD_INDEX;
+import static org.onap.validation.yaml.YamlLoadingUtils.YAML_DOCUMENT_WITH_MISSING_FIELD_AND_WRONG_VALUE_INDEX;
+
+
+public class YamlValidationProcessTest {
+
+ @Test
+ public void shouldReturnNoErrorWhenProcessingValidPmDictionaryYaml()
+ throws YamlProcessingException {
+ // given
+ List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFile();
+ YamlSchema schema = new YamlSchemaFactory().createTreeStructuredYamlSchema(documents.get(0));
+ YamlDocument document = documents.get(VALID_YAML_DOCUMENT_INDEX);
+
+ // when
+ List<SchemaValidationError> errors = new YamlValidationProcess(schema,document).validate();
+
+ // then
+ assertThat(errors).isEmpty();
+ }
+
+ @Test
+ public void shouldReturnOneErrorWhenProcessingPmDictionaryYamlWithMissingField()
+ throws YamlProcessingException {
+ // given
+ List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFile();
+ YamlSchema schema = new YamlSchemaFactory().createTreeStructuredYamlSchema(documents.get(0));
+ YamlDocument document = documents.get(YAML_DOCUMENT_WITH_MISSING_FIELD_INDEX);
+
+ // when
+ List<SchemaValidationError> errors = new YamlValidationProcess(schema,document).validate();
+
+ // then
+ assertThat(errors).hasSize(1);
+ }
+
+ @Test
+ public void shouldReturnTwoErrorsWhenProcessingPmDictionaryYamlWithMissingFieldAndIncorrectValue()
+ throws YamlProcessingException {
+ // given
+ List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFile();
+ YamlSchema schema = new YamlSchemaFactory().createTreeStructuredYamlSchema(documents.get(0));
+ YamlDocument document = documents.get(YAML_DOCUMENT_WITH_MISSING_FIELD_AND_WRONG_VALUE_INDEX);
+
+ // when
+ List<SchemaValidationError> errors = new YamlValidationProcess(schema,document).validate();
+
+ // then
+ assertThat(errors).hasSize(2);
+ }
+
+ @Test
+ public void shouldThrowExceptionWhenProcessingPmDictionaryIsNotValidYaml()
+ throws YamlProcessingException {
+ // given
+ List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFile();
+ YamlDocument schemaInYaml = YamlLoadingUtils.loadSimpleInvalidYamlSchemaForLazyLoadingFile();
+ YamlSchema schema = new YamlSchemaFactory().createTreeStructuredYamlSchema(schemaInYaml);
+ YamlDocument document = documents.get(VALID_YAML_DOCUMENT_INDEX);
+
+ // when then
+ assertThatThrownBy(() ->
+ new YamlValidationProcess(schema,document).validate()
+ ).isInstanceOf(YamlProcessingException.class)
+ .hasMessageContaining(
+ String.format("Lazy loading failed, due to yaml parsing exception.")
+ );
+ }
+}
diff --git a/csarvalidation/src/test/resources/yaml_schema/Multi_Document_Invalid.yaml b/csarvalidation/src/test/resources/yaml_schema/Multi_Document_Invalid.yaml
new file mode 100644
index 0000000..aab34fa
--- /dev/null
+++ b/csarvalidation/src/test/resources/yaml_schema/Multi_Document_Invalid.yaml
@@ -0,0 +1,86 @@
+...
+# 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
+ }
+ }
+}
+...
+---
+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,
+ vendorField2: A
+ }
+ }
+...
diff --git a/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml b/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml
index 5384dcd..3251ecf 100644
--- a/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml
+++ b/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml
@@ -12,7 +12,7 @@ pmMetaData: { presence: required, structure: {
},
pmDefSchemaVsn: {
presence: required,
- value: [2.0],
+ value: 2.0,
comment: "PM Dictionary Schema Version from the VES Event
Registration specification"
},
@@ -170,7 +170,7 @@ pmMetaData: {
measLastChange: 5G18A_1807_003,
measObjClass: NGCELL,
measResultRange: 0-4096,
- measResultType: integer,
+ measResultType: float,
measResultUnits: number,
measType: VS.NINFC.IntraFrPscelChFailTdcExp,
measAdditionalFields: {
@@ -197,7 +197,8 @@ pmMetaData: {
measLastChange: 5G19_1906_002,
measObjClass: NGCELL,
measResultRange: 0-4096,
- measResultType: integer,
+ measResultType: float,
+ measChangeType: added,
measResultUnits: number,
measType: VS.NINFC.IntraFrPscelChFailMenbRef,
measAdditionalFields: {