summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java3
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java22
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationProcess.java6
-rw-r--r--csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNodeFactory.java4
-rw-r--r--csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java22
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/YamlFileValidatorTest.java47
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java15
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java8
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java58
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java3
-rw-r--r--csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java9
-rw-r--r--csarvalidation/src/test/resources/pnf/r816745/csar-with-invalid-pm-dictionary.csarbin8774 -> 8796 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r816745/csar-with-valid-pm-dictionary.csarbin8728 -> 8792 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r816745/zip-with-invalid-pm-dictionary.zipbin6447 -> 6425 bytes
-rw-r--r--csarvalidation/src/test/resources/pnf/r816745/zip-with-valid-pm-dictionary.zipbin6396 -> 6419 bytes
-rw-r--r--csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml166
-rw-r--r--csarvalidation/src/test/resources/yaml_schema/PM_Dictionary_JSON_Style.yaml239
17 files changed, 462 insertions, 140 deletions
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java
index 7f80d1c..11582d1 100644
--- a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlDocument.java
@@ -39,8 +39,7 @@ public class YamlDocument {
return yaml.get(key).toString();
}
- public YamlParametersList getListOfValues(String key)
- throws YamlParameterListFactory.YamlParameterListParsingException {
+ public YamlParametersList getListOfValues(String key) {
return new YamlParameterListFactory().createYamlParameterList(
yaml.get(key)
);
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java
index 4ea5ca2..5f41c5c 100644
--- a/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/model/YamlParameterListFactory.java
@@ -17,8 +17,6 @@
package org.onap.validation.yaml.model;
-import org.onap.validation.yaml.exception.YamlProcessingException;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -29,18 +27,7 @@ public class YamlParameterListFactory {
return new YamlParametersList(Collections.emptyList());
}
- public YamlParametersList createYamlParameterList(Object yaml)
- throws YamlParameterListParsingException {
- try {
- return parseYamlToListOfPossibleValues(yaml);
- } catch (ClassCastException e) {
- throw new YamlParameterListParsingException(
- String.format("Fail to parse given objects: %s as list.",yaml), e
- );
- }
- }
-
- private YamlParametersList parseYamlToListOfPossibleValues(Object yaml) {
+ public YamlParametersList createYamlParameterList(Object yaml) {
List<String> parametersList = new ArrayList<>();
if( yaml instanceof List) {
for (Object element : (List) yaml) {
@@ -52,11 +39,4 @@ public class YamlParameterListFactory {
return new YamlParametersList(parametersList);
}
-
- public static class YamlParameterListParsingException extends YamlProcessingException {
- YamlParameterListParsingException(String message, Throwable throwable) {
- super(message, throwable);
- }
- }
-
}
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
index e3fadb6..273014b 100644
--- a/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationProcess.java
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/process/YamlValidationProcess.java
@@ -74,7 +74,9 @@ public class YamlValidationProcess {
private boolean isValueOfNodeInAcceptedValuesList(YamlDocument document, YamlSchemaNode node) {
return node.getAcceptedValues().isEmpty() ||
- node.getAcceptedValues().contains(document.getValue(node.getName()));
+ node.getAcceptedValues().containsAll(
+ document.getListOfValues(node.getName()).getParameters()
+ );
}
private void addNextLevelNodeToValidationNodesQueue(YamlDocument document, YamlSchemaNode node)
@@ -101,7 +103,7 @@ public class YamlValidationProcess {
new SchemaValidationError(
node.getPath() + node.getName(),
String.format(
- "Value is not in array of accepted values.%n value: %s%n accepted values: %s",
+ "Value(s) is/are not in array of accepted values.%n value(s): %s%n accepted value(s): %s",
document.getValue(node.getName()), node.getAcceptedValues())
)
);
diff --git a/csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNodeFactory.java b/csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNodeFactory.java
index a07935a..79a8f14 100644
--- a/csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNodeFactory.java
+++ b/csarvalidation/src/main/java/org/onap/validation/yaml/schema/node/YamlSchemaNodeFactory.java
@@ -24,7 +24,6 @@ import org.onap.validation.yaml.model.YamlParameterListFactory;
import org.onap.validation.yaml.model.YamlParametersList;
import static org.onap.validation.yaml.model.YamlDocumentFactory.YamlDocumentParsingException;
-import static org.onap.validation.yaml.model.YamlParameterListFactory.YamlParameterListParsingException;
public class YamlSchemaNodeFactory {
@@ -65,8 +64,7 @@ public class YamlSchemaNodeFactory {
: EMPTY_COMMENT;
}
- private YamlParametersList getAcceptedValues(YamlDocument yamlDocument)
- throws YamlParameterListParsingException {
+ private YamlParametersList getAcceptedValues(YamlDocument yamlDocument) {
return isYamlContainingKey(yamlDocument, VALUE_KET)
? new YamlParameterListFactory().createYamlParameterList(yamlDocument.getYaml().get(VALUE_KET))
diff --git a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java
index 70a370e..5ef4e99 100644
--- a/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java
+++ b/csarvalidation/src/test/java/org/onap/cvc/csar/cc/sol004/VTPValidateCSARR816745IntegrationTest.java
@@ -38,6 +38,7 @@ public class VTPValidateCSARR816745IntegrationTest {
private static final boolean IS_PNF = true;
private static final String TEST_CSAR_DIRECTORY = "pnf/r816745/";
+ private static final int NUMBER_OF_EXPECTED_ERRORS = 4;
private VTPValidateCSARR816745 testCase;
@@ -132,12 +133,13 @@ public class VTPValidateCSARR816745IntegrationTest {
}
private void assertThatReturnedErrorsAreCorrect(List<CSARArchive.CSARError> errors) {
- assertThat(errors.size()).isEqualTo(3);
+ assertThat(errors.size()).isEqualTo(NUMBER_OF_EXPECTED_ERRORS);
Condition<String> containingSameFileForAllErrors = new HamcrestCondition<>(
containsString("Artifacts/Deployment/Measurements/PM_Dictionary.yml")
);
- assertThat(convertToFilesList(errors)).haveExactly(3, containingSameFileForAllErrors);
+ assertThat(convertToFilesList(errors))
+ .haveExactly(NUMBER_OF_EXPECTED_ERRORS, containingSameFileForAllErrors);
Condition<String> containingErrorForMissingValueInFirstDocument = new HamcrestCondition<>(allOf(
containsString("Invalid YAML document in PM_Dictionary file."),
@@ -151,9 +153,9 @@ public class VTPValidateCSARR816745IntegrationTest {
containsString("Invalid YAML document in PM_Dictionary file."),
containsString("In document number 1"),
containsString("Path: /pmMetaData/pmFields/measResultType"),
- containsString("Value is not in array of accepted values."),
- containsString("value: integer"),
- containsString("accepted values: [float, uint32, uint64]")
+ containsString("Value(s) is/are not in array of accepted values."),
+ containsString("value(s): integer"),
+ containsString("accepted value(s): [float, uint32, uint64]")
));
assertThat(convertToMessagesList(errors)).haveExactly(1, containingErrorForWrongValueInFirstDocument);
@@ -164,6 +166,16 @@ public class VTPValidateCSARR816745IntegrationTest {
containsString("Key not found: measChangeType")
));
assertThat(convertToMessagesList(errors)).haveExactly(1, containingErrorForMissingValueInSecondDocument);
+
+ Condition<String> containingErrorForWrongValueInArrayInThirdDocument = new HamcrestCondition<>(allOf(
+ containsString("Invalid YAML document in PM_Dictionary file."),
+ containsString("In document number 3"),
+ containsString("Path: /pmMetaData/pmFields/measAdditionalFields/vendorField1"),
+ containsString("Value(s) is/are not in array of accepted values."),
+ containsString("value(s): [Z, A]"),
+ containsString("accepted value(s): [X, Y, Z]")
+ ));
+ assertThat(convertToMessagesList(errors)).haveExactly(1, containingErrorForWrongValueInArrayInThirdDocument);
}
}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlFileValidatorTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlFileValidatorTest.java
index 6ef78ae..d29b41a 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlFileValidatorTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlFileValidatorTest.java
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
public class YamlFileValidatorTest {
@Test
- public void shouldReturnNoErrorsWhenGivenPathToValidPmDictionaryFile() throws YamlProcessingException {
+ public void shouldReturnCorrectErrorsWhenGivenPathToValidPmDictionaryFile() throws YamlProcessingException {
// given
String path = getFullPathForGivenResources(YamlLoadingUtils.PATH_TO_VALID_YAML);
@@ -40,25 +40,48 @@ public class YamlFileValidatorTest {
new YamlFileValidator().validateYamlFileWithSchema(path);
// then
+ assertValidationReturnedExpectedErrors(validationErrors);
+
+ }
+
+ @Test
+ public void shouldReturnCorrecErrorsWhenGivenPathToValidJsonStylePmDictionaryFile() throws YamlProcessingException {
+ // given
+ String path = getFullPathForGivenResources(YamlLoadingUtils.PATH_TO_VALID_JSON_STYLE_YAML);
+
+ // when
+ List<YamlDocumentValidationError> validationErrors =
+ new YamlFileValidator().validateYamlFileWithSchema(path);
+
+ // then
+ assertValidationReturnedExpectedErrors(validationErrors);
+ }
+
+
+ private void assertValidationReturnedExpectedErrors(List<YamlDocumentValidationError> validationErrors) {
assertThat(validationErrors).isNotNull();
- assertThat(validationErrors).hasSize(3);
+ assertThat(validationErrors).hasSize(4);
assertThat(validationErrors).usingRecursiveFieldByFieldElementComparator().containsAll(
Lists.list(
- new YamlDocumentValidationError(1 ,
- "/pmMetaData/pmFields/measResultType" ,
- "Value is not in array of accepted values.\n" +
- " value: integer\n" +
- " accepted values: [float, uint32, uint64]"),
- new YamlDocumentValidationError(1 ,
+ new YamlDocumentValidationError(1,
+ "/pmMetaData/pmFields/measResultType",
+ "Value(s) is/are not in array of accepted values.\n" +
+ " value(s): integer\n" +
+ " accepted value(s): [float, uint32, uint64]"),
+ new YamlDocumentValidationError(1,
"/pmMetaData/pmFields/",
- "Key not found: measChangeType"),
- new YamlDocumentValidationError(2 ,
+ "Key not found: measChangeType"),
+ new YamlDocumentValidationError(2,
"/pmMetaData/pmFields/",
- "Key not found: measChangeType")
+ "Key not found: measChangeType"),
+ new YamlDocumentValidationError(3,
+ "/pmMetaData/pmFields/measAdditionalFields/vendorField1",
+ "Value(s) is/are not in array of accepted values.\n" +
+ " value(s): [Z, A]\n" +
+ " accepted value(s): [X, Y, Z]")
)
);
}
-
@Test
public void shouldThrowErrorWhenGivenPathToInvalidPmDictionaryFile() {
// given
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 e7efc2b..9e7af5d 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoaderTest.java
@@ -31,13 +31,24 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
public class YamlLoaderTest {
+ private static final int EXPECTED_NUMBER_OF_DOCUMENTS = 5;
+
@Test
public void shouldLoadAllDocumentsFromYamlFile() throws YamlDocumentFactory.YamlDocumentParsingException {
// when
List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFile();
// then
- assertThat(documents).hasSize(4);
+ assertThat(documents).hasSize(EXPECTED_NUMBER_OF_DOCUMENTS);
+ }
+
+ @Test
+ public void shouldLoadAllDocumentsFromJsonStyleYamlFile() throws YamlDocumentFactory.YamlDocumentParsingException {
+ // when
+ List<YamlDocument> documents = YamlLoadingUtils.loadValidJsonStyleMultiDocumentYamlFile();
+
+ // then
+ assertThat(documents).hasSize(EXPECTED_NUMBER_OF_DOCUMENTS);
}
@Test
@@ -46,7 +57,7 @@ public class YamlLoaderTest {
List<YamlDocument> documents = YamlLoadingUtils.loadValidMultiDocumentYamlFileUsingStringPath();
// then
- assertThat(documents).hasSize(4);
+ assertThat(documents).hasSize(EXPECTED_NUMBER_OF_DOCUMENTS);
}
@Test
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 5e09e0a..9df15cd 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlLoadingUtils.java
@@ -29,11 +29,13 @@ public final class YamlLoadingUtils {
private YamlLoadingUtils() {}
- public static final int VALID_YAML_DOCUMENT_INDEX = 3;
+ public static final int VALID_YAML_DOCUMENT_INDEX = 4;
+ public static final int YAML_DOCUMENT_WITH_WRONG_VALUE_IN_ARRAY_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;
static final String PATH_TO_VALID_YAML = "yaml_schema/PM_Dictionary.yaml";
+ static final String PATH_TO_VALID_JSON_STYLE_YAML = "yaml_schema/PM_Dictionary_JSON_Style.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";
@@ -44,6 +46,10 @@ public final class YamlLoadingUtils {
return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_VALID_YAML));
}
+ public static List<YamlDocument> loadValidJsonStyleMultiDocumentYamlFile() throws YamlDocumentParsingException {
+ return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_VALID_JSON_STYLE_YAML));
+ }
+
public static List<YamlDocument> loadValidMultiDocumentYamlFileUsingStringPath() throws YamlProcessingException {
return new YamlLoader().loadMultiDocumentYamlFile(getUrlForGivenPath(PATH_TO_VALID_YAML).getPath());
}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java
index 4927d32..efe9d69 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/YamlValidatorTest.java
@@ -32,9 +32,29 @@ 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;
+import static org.onap.validation.yaml.YamlLoadingUtils.YAML_DOCUMENT_WITH_WRONG_VALUE_IN_ARRAY_INDEX;
public class YamlValidatorTest {
+
+ @Test
+ public void shouldCreateValidatorUsingSchemaLoadedFromYamlFileAndValidatedJsonStyleDocumentsFromThatFile()
+ throws YamlProcessingException {
+
+ // given
+ List<YamlDocument> documents = YamlLoadingUtils.loadValidJsonStyleMultiDocumentYamlFile();
+ YamlValidator validator = new YamlValidator(new YamlSchemaFactory().createTreeStructuredYamlSchema(documents.get(0)));
+ Map<Integer,List<SchemaValidationError>> validationErrors = new HashMap<>();
+
+ // when
+ for (int documentIndex = 1 ; documentIndex < documents.size() ; documentIndex++) {
+ validationErrors.put(documentIndex, validator.validate(documents.get(documentIndex)));
+ }
+
+ // then
+ assertValidatorReturnedCorrectErrors(validationErrors);
+ }
+
@Test
public void shouldCreateValidatorUsingSchemaLoadedFromYamlFileAndValidatedDocumentsFromThatFile()
throws YamlProcessingException {
@@ -44,26 +64,38 @@ public class YamlValidatorTest {
YamlValidator validator = new YamlValidator(new YamlSchemaFactory().createTreeStructuredYamlSchema(documents.get(0)));
Map<Integer,List<SchemaValidationError>> validationErrors = new HashMap<>();
+ // when
+ for (int documentIndex = 1 ; documentIndex < documents.size() ; documentIndex++) {
+ validationErrors.put(documentIndex, validator.validate(documents.get(documentIndex)));
+ }
+
+ // then
+ assertValidatorReturnedCorrectErrors(validationErrors);
+ }
+
+ private void assertValidatorReturnedCorrectErrors(Map<Integer, List<SchemaValidationError>> validationErrors) {
+
SchemaValidationError expectedValidationValueError =
new SchemaValidationError(
"/pmMetaData/pmFields/measResultType",
- "Value is not in array of accepted values.\n"
- + " value: integer\n"
- + " accepted values: [float, uint32, uint64]"
+ "Value(s) is/are not in array of accepted values.\n"
+ + " value(s): integer\n"
+ + " accepted value(s): [float, uint32, uint64]"
);
SchemaValidationError expectedValidationKeyError =
new SchemaValidationError(
"/pmMetaData/pmFields/",
"Key not found: measChangeType"
);
+ SchemaValidationError expectedValidationValuesInArrayError =
+ new SchemaValidationError(
+ "/pmMetaData/pmFields/measAdditionalFields/vendorField1",
+ "Value(s) is/are not in array of accepted values.\n"
+ + " value(s): [Z, A]\n"
+ + " accepted value(s): [X, Y, Z]"
+ );
- // 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.size()).isEqualTo(4);
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))
@@ -79,6 +111,12 @@ public class YamlValidatorTest {
.contains(
expectedValidationKeyError
);
+ assertThat(validationErrors.get(YAML_DOCUMENT_WITH_WRONG_VALUE_IN_ARRAY_INDEX)).hasSize(1);
+ assertThat(validationErrors.get(YAML_DOCUMENT_WITH_WRONG_VALUE_IN_ARRAY_INDEX))
+ .usingFieldByFieldElementComparator()
+ .contains(
+ expectedValidationValuesInArrayError
+ );
assertThat(validationErrors.get(VALID_YAML_DOCUMENT_INDEX)).hasSize(0);
}
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java
index 469b39f..5641a56 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlDocumentFactoryTest.java
@@ -29,7 +29,6 @@ import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.onap.validation.yaml.model.YamlDocumentFactory.YamlDocumentParsingException;
-import static org.onap.validation.yaml.model.YamlParameterListFactory.YamlParameterListParsingException;
public class YamlDocumentFactoryTest {
@@ -91,7 +90,7 @@ public class YamlDocumentFactoryTest {
@Test
public void shouldTurnMapOfUnknownKeyTypeToMapWithStringKeysAndBeAbleToExtractParametersList()
- throws YamlDocumentParsingException, YamlParameterListParsingException {
+ throws YamlDocumentParsingException {
// given
Map<Object, Object> inputMap = new HashMap<>();
List<String> parametersList = new LinkedList<>();
diff --git a/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java
index 1f370cb..34e61c5 100644
--- a/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java
+++ b/csarvalidation/src/test/java/org/onap/validation/yaml/model/YamlParameterListFactoryTest.java
@@ -37,8 +37,7 @@ public class YamlParameterListFactoryTest {
}
@Test
- public void shouldCreateParametersListContainingStringsFromListContainingSimpleTypes()
- throws YamlParameterListFactory.YamlParameterListParsingException {
+ public void shouldCreateParametersListContainingStringsFromListContainingSimpleTypes() {
// given
List<Object> testList = Lists.list("test1",3,23.45,'a',"test2");
@@ -52,8 +51,7 @@ public class YamlParameterListFactoryTest {
}
@Test
- public void shouldCreateParametersListContainingStringsFromListContainingVariousTypes()
- throws YamlParameterListFactory.YamlParameterListParsingException {
+ public void shouldCreateParametersListContainingStringsFromListContainingVariousTypes() {
// given
List<Object> testList = Lists.list("test1",3,Lists.list(2,3,4),"test2");
@@ -67,8 +65,7 @@ public class YamlParameterListFactoryTest {
}
@Test
- public void shouldCreateListWithOneStringWhenGivenObjectIsNotList()
- throws YamlParameterListFactory.YamlParameterListParsingException {
+ public void shouldCreateListWithOneStringWhenGivenObjectIsNotList() {
// given
Object testObject = "test";
diff --git a/csarvalidation/src/test/resources/pnf/r816745/csar-with-invalid-pm-dictionary.csar b/csarvalidation/src/test/resources/pnf/r816745/csar-with-invalid-pm-dictionary.csar
index 5f9d058..81a0e23 100644
--- a/csarvalidation/src/test/resources/pnf/r816745/csar-with-invalid-pm-dictionary.csar
+++ b/csarvalidation/src/test/resources/pnf/r816745/csar-with-invalid-pm-dictionary.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r816745/csar-with-valid-pm-dictionary.csar b/csarvalidation/src/test/resources/pnf/r816745/csar-with-valid-pm-dictionary.csar
index 2768e16..cc7db55 100644
--- a/csarvalidation/src/test/resources/pnf/r816745/csar-with-valid-pm-dictionary.csar
+++ b/csarvalidation/src/test/resources/pnf/r816745/csar-with-valid-pm-dictionary.csar
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r816745/zip-with-invalid-pm-dictionary.zip b/csarvalidation/src/test/resources/pnf/r816745/zip-with-invalid-pm-dictionary.zip
index 3c46ef8..032dc78 100644
--- a/csarvalidation/src/test/resources/pnf/r816745/zip-with-invalid-pm-dictionary.zip
+++ b/csarvalidation/src/test/resources/pnf/r816745/zip-with-invalid-pm-dictionary.zip
Binary files differ
diff --git a/csarvalidation/src/test/resources/pnf/r816745/zip-with-valid-pm-dictionary.zip b/csarvalidation/src/test/resources/pnf/r816745/zip-with-valid-pm-dictionary.zip
index 6c8970c..b8c26d3 100644
--- a/csarvalidation/src/test/resources/pnf/r816745/zip-with-valid-pm-dictionary.zip
+++ b/csarvalidation/src/test/resources/pnf/r816745/zip-with-valid-pm-dictionary.zip
Binary files differ
diff --git a/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml b/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml
index 3251ecf..12a4af9 100644
--- a/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml
+++ b/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary.yaml
@@ -123,88 +123,106 @@ pmMetaData: { presence: required, structure: {
...
# PM Dictionary perf3gpp measurements for the gnb-Nokia NF (bracket style yaml)
---
-pmMetaData: {
- pmHeader: {
- nfType: gnb-Nokia,
- pmDefSchemaVsn: 2.0,
+pmMetaData:
+ pmHeader:
+ nfType: gnb-Nokia
+ pmDefSchemaVsn: 2.0
pmDefVsn: 5G19_1906_002
- },
- pmFields: {
- iMeasInfoId: 2204,
- iMeasType: 1,
-
- measCollectionMethod: CC,
+ 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,
+ 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,
+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
- }
- }
-}
+ 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,
+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,
+ 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/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary_JSON_Style.yaml b/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary_JSON_Style.yaml
new file mode 100644
index 0000000..f4cbddf
--- /dev/null
+++ b/csarvalidation/src/test/resources/yaml_schema/PM_Dictionary_JSON_Style.yaml
@@ -0,0 +1,239 @@
+---
+# 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,Z]
+ }
+ }
+}
+...
+---
+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
+ }
+ }
+}
+...