aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/dcae/ApplicationSettingsTest.java121
-rw-r--r--src/test/java/org/onap/dcae/TLSTest.java15
-rw-r--r--src/test/java/org/onap/dcae/common/validator/GeneralEventValidatorTest.java (renamed from src/test/java/org/onap/dcae/restapi/EventValidatorTest.java)21
-rw-r--r--src/test/java/org/onap/dcae/common/validator/StndDefinedDataValidatorTest.java149
-rw-r--r--src/test/java/org/onap/dcae/common/validator/StndDefinedValidatorResolverTest.java65
-rw-r--r--src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java49
-rw-r--r--src/test/resources/stndDefined/OpenAPI_faultMnS.yaml1144
-rw-r--r--src/test/resources/stndDefined/schema-map.json6
-rw-r--r--src/test/resources/ves7_batch_with_stndDefined_valid.json109
-rw-r--r--src/test/resources/ves7_valid_eventWithStndDefinedFields.json49
-rw-r--r--src/test/resources/ves_stdnDefined_empty_namespace_invalid.json2
-rw-r--r--src/test/resources/ves_stdnDefined_invalid.json54
-rw-r--r--src/test/resources/ves_stdnDefined_missing_local_schema_reference.json54
-rw-r--r--src/test/resources/ves_stdnDefined_missing_namespace_invalid.json2
-rw-r--r--src/test/resources/ves_stdnDefined_valid.json51
-rw-r--r--src/test/resources/ves_stdnDefined_with_empty_stndDefined_fields_data.json24
-rw-r--r--src/test/resources/ves_stdnDefined_without_schema_reference.json22
-rw-r--r--src/test/resources/ves_stdnDefined_wrong_internal_file_reference.json54
18 files changed, 1870 insertions, 121 deletions
diff --git a/src/test/java/org/onap/dcae/ApplicationSettingsTest.java b/src/test/java/org/onap/dcae/ApplicationSettingsTest.java
index 6560b1ce..6ea94ab5 100644
--- a/src/test/java/org/onap/dcae/ApplicationSettingsTest.java
+++ b/src/test/java/org/onap/dcae/ApplicationSettingsTest.java
@@ -21,20 +21,13 @@
package org.onap.dcae;
-import static java.util.Collections.singletonList;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.onap.dcae.CLIUtils.processCmdLine;
-import static org.onap.dcae.TestingUtilities.createTemporaryFile;
-
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.networknt.schema.JsonSchema;
import io.vavr.collection.HashMap;
import io.vavr.collection.Map;
+import org.junit.Test;
+
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -42,7 +35,15 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Objects;
-import org.junit.Test;
+
+import static java.util.Collections.singletonList;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.dcae.CLIUtils.processCmdLine;
+import static org.onap.dcae.TestingUtilities.createTemporaryFile;
public class ApplicationSettingsTest {
@@ -70,7 +71,7 @@ public class ApplicationSettingsTest {
@Test
public void shouldMakeApplicationSettingsOutOfCLIArgumentsAndAConfigurationFile()
- throws IOException {
+ throws IOException {
// given
File tempConfFile = File.createTempFile("doesNotMatter", "doesNotMatter");
Files.write(tempConfFile.toPath(), Arrays.asList("section.subSection1=abc", "section.subSection2=zxc"));
@@ -111,7 +112,7 @@ public class ApplicationSettingsTest {
public void shouldReturnHTTPPort() throws IOException {
// when
int applicationPort = fromTemporaryConfiguration("collector.service.port=8090")
- .httpPort();
+ .httpPort();
// then
assertEquals(8090, applicationPort);
@@ -130,7 +131,7 @@ public class ApplicationSettingsTest {
public void shouldReturnIfHTTPSIsEnabled() throws IOException {
// when
boolean httpsEnabled = fromTemporaryConfiguration("collector.service.secure.port=8443")
- .httpsEnabled();
+ .httpsEnabled();
// then
assertTrue(httpsEnabled);
@@ -157,7 +158,7 @@ public class ApplicationSettingsTest {
public void shouldReturnHTTPSPort() throws IOException {
// when
int httpsPort = fromTemporaryConfiguration("collector.service.secure.port=8443")
- .httpsPort();
+ .httpsPort();
// then
assertEquals(8443, httpsPort);
@@ -167,7 +168,7 @@ public class ApplicationSettingsTest {
public void shouldReturnConfigurationUpdateInterval() throws IOException {
// when
int updateFrequency = fromTemporaryConfiguration("collector.dynamic.config.update.frequency=10")
- .configurationUpdateFrequency();
+ .configurationUpdateFrequency();
// then
assertEquals(10, updateFrequency);
@@ -177,7 +178,7 @@ public class ApplicationSettingsTest {
public void shouldReturnDefaultConfigurationUpdateInterval() throws IOException {
// when
int updateFrequency = fromTemporaryConfiguration()
- .configurationUpdateFrequency();
+ .configurationUpdateFrequency();
// then
assertEquals(5, updateFrequency);
@@ -187,7 +188,7 @@ public class ApplicationSettingsTest {
public void shouldReturnLocationOfThePasswordFile() throws IOException {
// when
String passwordFileLocation = fromTemporaryConfiguration("collector.keystore.passwordfile=/somewhere/password")
- .keystorePasswordFileLocation();
+ .keystorePasswordFileLocation();
// then
assertEquals(sanitizePath("/somewhere/password"), passwordFileLocation);
@@ -206,7 +207,7 @@ public class ApplicationSettingsTest {
public void shouldReturnLocationOfTheKeystoreFile() throws IOException {
// when
String keystoreFileLocation = fromTemporaryConfiguration("collector.keystore.file.location=/somewhere/keystore")
- .keystoreFileLocation();
+ .keystoreFileLocation();
// then
assertEquals(sanitizePath("/somewhere/keystore"), keystoreFileLocation);
@@ -225,7 +226,7 @@ public class ApplicationSettingsTest {
public void shouldReturnDMAAPConfigFileLocation() throws IOException {
// when
String dmaapConfigFileLocation = fromTemporaryConfiguration("collector.dmaapfile=/somewhere/dmaapFile")
- .dMaaPConfigurationFileLocation();
+ .dMaaPConfigurationFileLocation();
// then
assertEquals(sanitizePath("/somewhere/dmaapFile"), dmaapConfigFileLocation);
@@ -244,7 +245,7 @@ public class ApplicationSettingsTest {
public void shouldTellIfSchemaValidationIsEnabled() throws IOException {
// when
boolean jsonSchemaValidationEnabled = fromTemporaryConfiguration("collector.schema.checkflag=1")
- .eventSchemaValidationEnabled();
+ .eventSchemaValidationEnabled();
// then
assertTrue(jsonSchemaValidationEnabled);
@@ -266,8 +267,8 @@ public class ApplicationSettingsTest {
// when
JsonSchema schema = fromTemporaryConfiguration(
- String.format("collector.schema.file={\"v1\": \"%s\"}", temporarySchemaFile))
- .jsonSchema("v1");
+ String.format("collector.schema.file={\"v1\": \"%s\"}", temporarySchemaFile))
+ .jsonSchema("v1");
// then
JsonNode incorrectTestObject = new ObjectMapper().readTree("{ \"state\": 1 }");
@@ -295,7 +296,7 @@ public class ApplicationSettingsTest {
public void shouldReturnExceptionConfigFileLocation() throws IOException {
// when
String exceptionConfigFileLocation = fromTemporaryConfiguration("exceptionConfig=/somewhere/exceptionFile")
- .exceptionConfigFileLocation();
+ .exceptionConfigFileLocation();
// then
assertEquals("/somewhere/exceptionFile", exceptionConfigFileLocation);
@@ -315,14 +316,14 @@ public class ApplicationSettingsTest {
public void shouldReturnDMAAPStreamId() throws IOException {
// given
Map<String, String[]> expected = HashMap.of(
- "log", new String[]{"ves-syslog", "ves-auditlog"},
- "fault", new String[]{"ves-fault"}
+ "log", new String[]{"ves-syslog", "ves-auditlog"},
+ "fault", new String[]{"ves-fault"}
);
// when
Map<String, String[]> dmaapStreamID = fromTemporaryConfiguration(
- "collector.dmaap.streamid=fault=ves-fault|log=ves-syslog,ves-auditlog")
- .getDmaapStreamIds();
+ "collector.dmaap.streamid=fault=ves-fault|log=ves-syslog,ves-auditlog")
+ .getDmaapStreamIds();
// then
assertArrayEquals(expected.get("log").get(), Objects.requireNonNull(dmaapStreamID).get("log").get());
@@ -352,11 +353,11 @@ public class ApplicationSettingsTest {
public void shouldReturnValidCredentials() throws IOException {
// when
Map<String, String> allowedUsers = fromTemporaryConfiguration(
- "header.authlist=pasza,c2ltcGxlcGFzc3dvcmQNCg==|someoneelse,c2ltcGxlcGFzc3dvcmQNCg=="
+ "header.authlist=pasza,c2ltcGxlcGFzc3dvcmQNCg==|someoneelse,c2ltcGxlcGFzc3dvcmQNCg=="
).validAuthorizationCredentials();
// then
- assertEquals( "c2ltcGxlcGFzc3dvcmQNCg==", allowedUsers.get("pasza").get());
+ assertEquals("c2ltcGxlcGFzc3dvcmQNCg==", allowedUsers.get("pasza").get());
assertEquals("c2ltcGxlcGFzc3dvcmQNCg==", allowedUsers.get("someoneelse").get());
}
@@ -364,7 +365,7 @@ public class ApplicationSettingsTest {
public void shouldbyDefaultThereShouldBeNoValidCredentials() throws IOException {
// when
Map<String, String> userToBase64PasswordDelimitedByCommaSeparatedByPipes = fromTemporaryConfiguration().
- validAuthorizationCredentials();
+ validAuthorizationCredentials();
// then
assertTrue(userToBase64PasswordDelimitedByCommaSeparatedByPipes.isEmpty());
@@ -374,7 +375,7 @@ public class ApplicationSettingsTest {
public void shouldReturnIfEventTransformingIsEnabled() throws IOException {
// when
boolean isEventTransformingEnabled = fromTemporaryConfiguration("event.transform.flag=0")
- .eventTransformingEnabled();
+ .eventTransformingEnabled();
// then
assertFalse(isEventTransformingEnabled);
@@ -393,8 +394,8 @@ public class ApplicationSettingsTest {
public void shouldReturnCambriaConfigurationFileLocation() throws IOException {
// when
String cambriaConfigurationFileLocation = fromTemporaryConfiguration(
- "collector.dmaapfile=/somewhere/dmaapConfig")
- .dMaaPConfigurationFileLocation();
+ "collector.dmaapfile=/somewhere/dmaapConfig")
+ .dMaaPConfigurationFileLocation();
// then
assertEquals(sanitizePath("/somewhere/dmaapConfig"), cambriaConfigurationFileLocation);
@@ -404,14 +405,64 @@ public class ApplicationSettingsTest {
public void shouldReturnDefaultCambriaConfigurationFileLocation() throws IOException {
// when
String cambriaConfigurationFileLocation = fromTemporaryConfiguration()
- .dMaaPConfigurationFileLocation();
+ .dMaaPConfigurationFileLocation();
// then
assertEquals(sanitizePath("etc/DmaapConfig.json"), cambriaConfigurationFileLocation);
}
+ @Test
+ public void shouldReturnDefaultExternalSchemaSchemasLocation() throws IOException {
+ //when
+ String externalSchemaSchemasLocation = fromTemporaryConfiguration()
+ .getExternalSchemaSchemasLocation();
+
+ //then
+ assertEquals(sanitizePath("./etc/externalRepo"), externalSchemaSchemasLocation);
+ }
+
+ @Test
+ public void shouldReturnDefaultExternalSchemaMappingFileLocation() throws IOException {
+ //when
+ String externalSchemaMappingFileLocation = fromTemporaryConfiguration()
+ .getExternalSchemaMappingFileLocation();
+
+ //then
+ assertEquals(sanitizePath("./etc/externalRepo/schema-map.json"), externalSchemaMappingFileLocation);
+ }
+
+ @Test
+ public void shouldReturnDefaultExternalSchemaSchemaRefPath() throws IOException {
+ //when
+ String externalSchemaSchemaRefPath = fromTemporaryConfiguration()
+ .getExternalSchemaSchemaRefPath();
+
+ //then
+ assertEquals(sanitizePath("/event/stndDefinedFields/schemaReference"), externalSchemaSchemaRefPath);
+ }
+
+ @Test
+ public void shouldReturnDefaultExternalSchemaStndDefinedDataPath() throws IOException {
+ //when
+ String externalSchemaStndDefinedDataPath = fromTemporaryConfiguration()
+ .getExternalSchemaStndDefinedDataPath();
+
+ //then
+ assertEquals(sanitizePath("/event/stndDefinedFields/data"), externalSchemaStndDefinedDataPath);
+ }
+
+ @Test
+ public void shouldReturnEnabledExternalSchema2ndStageValidation() throws IOException {
+ //when
+ boolean externalSchema2ndStageValidation = fromTemporaryConfiguration("collector.externalSchema.2ndStageValidation=-1")
+ .getExternalSchemaValidationCheckflag();
+
+ //then
+ assertFalse(externalSchema2ndStageValidation);
+ }
+
private static ApplicationSettings fromTemporaryConfiguration(String... fileLines)
- throws IOException {
+ throws IOException {
File tempConfFile = File.createTempFile("doesNotMatter", "doesNotMatter");
Files.write(tempConfFile.toPath(), Arrays.asList(fileLines));
tempConfFile.deleteOnExit();
diff --git a/src/test/java/org/onap/dcae/TLSTest.java b/src/test/java/org/onap/dcae/TLSTest.java
index e55b6052..424ddf8b 100644
--- a/src/test/java/org/onap/dcae/TLSTest.java
+++ b/src/test/java/org/onap/dcae/TLSTest.java
@@ -37,6 +37,11 @@ import static org.onap.dcae.TLSTest.HttpsConfigurationWithTLSAuthenticationAndBa
public class TLSTest extends TLSTestBase {
+ private static final String MAPPING_FILE_LOCATION = "./etc/externalRepo/schema-map.json";
+ private static final String SCHEMA_FILES_LOCATION = "./etc/externalRepo";
+ private static final String STND_DEFINED_DATA_PATH = "/event/stndDefinedFields/data";
+ private static final String SCHEMA_REF_PATH = "/event/stndDefinedFields/schemaReference";
+
@Nested
@Import(HttpConfiguration.class)
class HttpTest extends TestClassBase {
@@ -69,10 +74,16 @@ public class TLSTest extends TLSTestBase {
// ApplicationSettings configurations
static class HttpConfiguration extends TLSTestBase.ConfigurationBase {
+
@Override
protected void configureSettings(ApplicationSettings settings) {
when(settings.authMethod()).thenReturn(AuthMethodType.NO_AUTH.value());
when(settings.httpPort()).thenReturn(1111);
+ when(settings.getExternalSchemaMappingFileLocation()).thenReturn(MAPPING_FILE_LOCATION);
+ when(settings.getExternalSchemaSchemasLocation()).thenReturn(SCHEMA_FILES_LOCATION);
+ when(settings.getExternalSchemaSchemaRefPath()).thenReturn(SCHEMA_REF_PATH);
+ when(settings.getExternalSchemaStndDefinedDataPath()).thenReturn(STND_DEFINED_DATA_PATH);
+
}
}
@@ -89,6 +100,10 @@ public class TLSTest extends TLSTestBase {
when(settings.truststorePasswordFileLocation()).thenReturn(TRUSTSTORE_PASSWORD_FILE.toString());
when(settings.certSubjectMatcher()).thenReturn(CERT_SUBJECT_MATCHER.toString());
when(settings.httpPort()).thenReturn(1111);
+ when(settings.getExternalSchemaMappingFileLocation()).thenReturn(MAPPING_FILE_LOCATION);
+ when(settings.getExternalSchemaSchemasLocation()).thenReturn(SCHEMA_FILES_LOCATION);
+ when(settings.getExternalSchemaSchemaRefPath()).thenReturn(SCHEMA_REF_PATH);
+ when(settings.getExternalSchemaStndDefinedDataPath()).thenReturn(STND_DEFINED_DATA_PATH);
}
}
} \ No newline at end of file
diff --git a/src/test/java/org/onap/dcae/restapi/EventValidatorTest.java b/src/test/java/org/onap/dcae/common/validator/GeneralEventValidatorTest.java
index 0ca5c424..e5e21177 100644
--- a/src/test/java/org/onap/dcae/restapi/EventValidatorTest.java
+++ b/src/test/java/org/onap/dcae/common/validator/GeneralEventValidatorTest.java
@@ -18,31 +18,34 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.dcae.restapi;
+package org.onap.dcae.common.validator;
import com.networknt.schema.JsonSchema;
import com.networknt.schema.JsonSchemaFactory;
import org.json.JSONObject;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.onap.dcae.ApplicationSettings;
import org.onap.dcae.FileReader;
import org.onap.dcae.common.model.VesEvent;
+import org.onap.dcae.restapi.ApiException;
+import org.onap.dcae.restapi.EventValidatorException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
-class EventValidatorTest {
+class GeneralEventValidatorTest {
private static final String DUMMY_SCHEMA_VERSION = "v5";
private static final String DUMMY_TYPE = "type";
private final String newSchemaV7 = FileReader.readFileAsString("etc/CommonEventFormat_30.2_ONAP.json");
@@ -54,9 +57,9 @@ class EventValidatorTest {
@Mock
private ApplicationSettings settings;
- private SchemaValidator schemaValidator = spy( new SchemaValidator());
+ private SchemaValidator schemaValidator = Mockito.spy( new SchemaValidator());
- private EventValidator sut;
+ private GeneralEventValidator sut;
@BeforeAll
@@ -66,7 +69,7 @@ class EventValidatorTest {
@BeforeEach
public void setUp(){
- this.sut = new EventValidator(settings, schemaValidator);
+ this.sut = new GeneralEventValidator(settings, schemaValidator);
}
@Test
@@ -92,7 +95,7 @@ class EventValidatorTest {
sut.validate(new VesEvent(jsonObject), "wrongType", DUMMY_SCHEMA_VERSION);
} catch (EventValidatorException e) {
//then
- assertEquals(ApiException.INVALID_JSON_INPUT, e.getApiException());
+ Assertions.assertEquals(ApiException.INVALID_JSON_INPUT, e.getApiException());
}
@@ -149,7 +152,7 @@ class EventValidatorTest {
@Test
void shouldReturnNoErrorsWhenValidatingValidEventWithStndDefinedFields() {
//given
- sentEvent = new JSONObject(FileReader.readFileAsString("src/test/resources/ves7_valid_eventWithStndDefinedFields.json"));
+ sentEvent = new JSONObject(FileReader.readFileAsString("src/test/resources/ves_stdnDefined_valid.json"));
mockJsonSchema(newSchemaV7);
when(settings.eventSchemaValidationEnabled()).thenReturn(true);
@@ -191,4 +194,4 @@ class EventValidatorTest {
JsonSchema schema = factory.getSchema(jsonSchemaContent);
when(settings.jsonSchema(any())).thenReturn(schema);
}
-}
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/dcae/common/validator/StndDefinedDataValidatorTest.java b/src/test/java/org/onap/dcae/common/validator/StndDefinedDataValidatorTest.java
new file mode 100644
index 00000000..1058b21f
--- /dev/null
+++ b/src/test/java/org/onap/dcae/common/validator/StndDefinedDataValidatorTest.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.onap.dcaegen2.collectors.ves
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcae.common.validator;
+
+import org.jetbrains.annotations.NotNull;
+import org.json.JSONObject;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.onap.dcae.ApplicationSettings;
+import org.onap.dcae.FileReader;
+import org.onap.dcae.common.model.VesEvent;
+import org.onap.dcae.restapi.ApiException;
+import org.onap.dcae.restapi.EventValidatorException;
+
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+public class StndDefinedDataValidatorTest {
+
+ @Mock
+ private ApplicationSettings settings;
+ private StndDefinedDataValidator stndDefinedDataValidator;
+
+ private static final String MAPPING_FILE_LOCATION = "./src/test/resources/stndDefined/schema-map.json";
+ private static final String SCHEMA_FILES_LOCATION = "./src/test/resources/stndDefined";
+ private static final String STND_DEFINED_DATA_PATH = "/event/stndDefinedFields/data";
+ private static final String SCHEMA_REF_PATH = "/event/stndDefinedFields/schemaReference";
+
+ @BeforeEach
+ public void setUp() {
+ mockStndDefinedValidationProps();
+ StndDefinedValidatorResolver stndDefinedValidatorResolver = new StndDefinedValidatorResolver(settings);
+ stndDefinedDataValidator = new StndDefinedDataValidator(stndDefinedValidatorResolver.resolve());
+ }
+
+ @Test
+ public void shouldReturnTrueWhenEventIsValid() throws EventValidatorException {
+ //given
+ VesEvent event = getVesEvent("src/test/resources/ves_stdnDefined_valid.json");
+
+ //when
+ //then
+ assertDoesNotThrow(() -> stndDefinedDataValidator.validate(event));
+ }
+
+ @Test
+ public void shouldReturnFalseWhenEventIsInvalid() throws EventValidatorException {
+ //given
+ VesEvent event = getVesEvent("src/test/resources/ves_stdnDefined_invalid.json");
+
+ try {
+ //when
+ stndDefinedDataValidator.validate(event);
+ } catch (EventValidatorException e) {
+ //then
+ assertEquals(ApiException.STND_DEFINED_VALIDATION_FAILED, e.getApiException());
+ }
+ }
+
+ @Test
+ void shouldReturnErrorWhenMissingLocalSchemaReferenceInMappingFile() {
+ //given
+ VesEvent event = getVesEvent("src/test/resources/ves_stdnDefined_missing_local_schema_reference.json");
+ try {
+ //when
+ stndDefinedDataValidator.validate(event);
+ } catch (EventValidatorException e) {
+ //then
+ assertEquals(ApiException.NO_LOCAL_SCHEMA_REFERENCE, e.getApiException());
+ }
+ }
+
+ @Test
+ void shouldReturnErrorWhenIncorrectInternalFileReference() {
+ //given
+ VesEvent event = getVesEvent("src/test/resources/ves_stdnDefined_wrong_internal_file_reference.json");
+ try {
+ //when
+ stndDefinedDataValidator.validate(event);
+ } catch (EventValidatorException e) {
+ //then
+ assertEquals(ApiException.INCORRECT_INTERNAL_FILE_REFERENCE, e.getApiException());
+ }
+ }
+
+ @Test
+ void shouldReturnErrorWhenStndDefinedFieldsDataIsEmpty() {
+ //given
+ VesEvent event = getVesEvent("src/test/resources/ves_stdnDefined_with_empty_stndDefined_fields_data.json");
+ try {
+ //when
+ stndDefinedDataValidator.validate(event);
+ } catch (EventValidatorException e) {
+ //then
+ assertEquals(ApiException.STND_DEFINED_VALIDATION_FAILED, e.getApiException());
+ }
+ }
+
+ @Test
+ void shouldNotReturnErrorWhenValidatingInvalidEventAndStndDefinedReferenceMissing() {
+ //given
+ VesEvent event = getVesEvent("src/test/resources/ves_stdnDefined_without_schema_reference.json");
+
+ //when
+ //then
+ assertDoesNotThrow(() -> stndDefinedDataValidator.validate(event));
+ }
+
+ @NotNull
+ private VesEvent getVesEvent(String filename) {
+ JSONObject jsonObjectEvent = getJsonObjectEvent(filename);
+ return new VesEvent(jsonObjectEvent);
+ }
+
+ private JSONObject getJsonObjectEvent(String fileName) {
+ String eventContent = FileReader.readFileAsString(fileName);
+ return new JSONObject(eventContent);
+ }
+
+ private void mockStndDefinedValidationProps() {
+ when(settings.getExternalSchemaMappingFileLocation()).thenReturn(MAPPING_FILE_LOCATION);
+ when(settings.getExternalSchemaSchemaRefPath()).thenReturn(SCHEMA_REF_PATH);
+ when(settings.getExternalSchemaSchemasLocation()).thenReturn(SCHEMA_FILES_LOCATION);
+ when(settings.getExternalSchemaStndDefinedDataPath()).thenReturn(STND_DEFINED_DATA_PATH);
+ }
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/dcae/common/validator/StndDefinedValidatorResolverTest.java b/src/test/java/org/onap/dcae/common/validator/StndDefinedValidatorResolverTest.java
new file mode 100644
index 00000000..9cdfdcbd
--- /dev/null
+++ b/src/test/java/org/onap/dcae/common/validator/StndDefinedValidatorResolverTest.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * org.onap.dcaegen2.collectors.ves
+ * ================================================================================
+ * Copyright (C) 2020 Nokia. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.dcae.common.validator;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.onap.dcae.ApplicationSettings;
+
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+public class StndDefinedValidatorResolverTest {
+
+ @Mock
+ private ApplicationSettings settings;
+
+ private static final String MAPPING_FILE_LOCATION = "./src/test/resources/stndDefined/schema-map.json";
+ private static final String SCHEMA_FILES_LOCATION = "./src/test/resources/stndDefined";
+ private static final String STND_DEFINED_DATA_PATH = "/event/stndDefinedFields/data";
+ private static final String SCHEMA_REF_PATH = "/event/stndDefinedFields/schemaReference";
+ StndDefinedValidatorResolver stndDefinedValidatorResolver;
+
+ @BeforeEach
+ public void setUp() {
+ mockStndDefinedValidationProps();
+ stndDefinedValidatorResolver = new StndDefinedValidatorResolver(settings);
+ }
+
+ @Test
+ public void shouldReturnStndValidatorWithDefaultSchemaConfigurations() {
+ //then
+ Assertions.assertDoesNotThrow(() -> stndDefinedValidatorResolver.resolve());
+ }
+
+ private void mockStndDefinedValidationProps() {
+ when(settings.getExternalSchemaMappingFileLocation()).thenReturn(MAPPING_FILE_LOCATION);
+ when(settings.getExternalSchemaSchemaRefPath()).thenReturn(SCHEMA_REF_PATH);
+ when(settings.getExternalSchemaSchemasLocation()).thenReturn(SCHEMA_FILES_LOCATION);
+ when(settings.getExternalSchemaStndDefinedDataPath()).thenReturn(STND_DEFINED_DATA_PATH);
+ }
+
+
+} \ No newline at end of file
diff --git a/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java b/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java
index 10423053..765f2b43 100644
--- a/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java
+++ b/src/test/java/org/onap/dcae/restapi/VesRestControllerTest.java
@@ -40,6 +40,7 @@ import org.onap.dcae.common.EventSender;
import org.onap.dcae.common.EventTransformation;
import org.onap.dcae.common.HeaderUtils;
import org.onap.dcae.common.JsonDataLoader;
+import org.onap.dcae.common.validator.StndDefinedDataValidator;
import org.onap.dcae.common.publishing.EventPublisher;
import org.slf4j.Logger;
import org.springframework.http.ResponseEntity;
@@ -85,16 +86,17 @@ public class VesRestControllerTest {
@Mock
private EventPublisher eventPublisher;
+ @Mock
+ private StndDefinedDataValidator stndDefinedDataValidator;
+
@Before
public void setUp(){
-
final HashMap<String, String[]> streamIds = HashMap.of(
"fault", new String[]{VES_FAULT_TOPIC},
"3GPP-FaultSupervision", new String[]{VES_3_GPP_FAULT_SUPERVISION_TOPIC}
);
- this.vesRestController = new VesRestController(
- applicationSettings, logger, new EventSender(eventPublisher, streamIds),headerUtils
- );
+ this.vesRestController = new VesRestController(applicationSettings, logger,
+ new EventSender(eventPublisher, streamIds), headerUtils, stndDefinedDataValidator);
}
@Test
@@ -229,7 +231,6 @@ public class VesRestControllerTest {
configureHeadersForEventListener();
MockHttpServletRequest request = givenMockHttpServletRequest();
-
String validEvent = JsonDataLoader.loadContent("/ves_stdnDefined_valid_unknown_topic.json");
//when
@@ -241,6 +242,44 @@ public class VesRestControllerTest {
verifyThatEventWasNotSend();
}
+ @Test
+ public void shouldExecuteStndDefinedValidationWhenFlagIsOnTrue() throws IOException {
+ //given
+ configureEventTransformations();
+ configureHeadersForEventListener();
+
+ MockHttpServletRequest request = givenMockHttpServletRequest();
+ String validEvent = JsonDataLoader.loadContent("/ves7_batch_with_stndDefined_valid.json");
+ when(applicationSettings.getExternalSchemaValidationCheckflag()).thenReturn(true);
+
+ //when
+ final ResponseEntity<String> response = vesRestController.events(validEvent, VERSION_V7, request);
+
+ //then
+ assertThat(response.getStatusCodeValue()).isEqualTo(HttpStatus.SC_ACCEPTED);
+ assertThat(response.getBody()).isEqualTo(ACCEPTED);
+ verify(stndDefinedDataValidator, times(2)).validate(any());
+ }
+
+ @Test
+ public void shouldNotExecuteStndDefinedValidationWhenFlagIsOnFalse() throws IOException {
+ //given
+ configureEventTransformations();
+ configureHeadersForEventListener();
+
+ MockHttpServletRequest request = givenMockHttpServletRequest();
+ String validEvent = JsonDataLoader.loadContent("/ves7_batch_with_stndDefined_valid.json");
+ when(applicationSettings.getExternalSchemaValidationCheckflag()).thenReturn(false);
+
+ //when
+ final ResponseEntity<String> response = vesRestController.events(validEvent, VERSION_V7, request);
+
+ //then
+ assertThat(response.getStatusCodeValue()).isEqualTo(HttpStatus.SC_ACCEPTED);
+ assertThat(response.getBody()).isEqualTo(ACCEPTED);
+ verify(stndDefinedDataValidator, times(0)).validate(any());
+ }
+
private void verifyThatEventWasNotSend() {
verify(eventPublisher, never()).sendEvent(any(), any());
}
diff --git a/src/test/resources/stndDefined/OpenAPI_faultMnS.yaml b/src/test/resources/stndDefined/OpenAPI_faultMnS.yaml
new file mode 100644
index 00000000..499123b9
--- /dev/null
+++ b/src/test/resources/stndDefined/OpenAPI_faultMnS.yaml
@@ -0,0 +1,1144 @@
+openapi: 3.0.1
+info:
+ title: Fault Supervision MnS
+ version: 16.4.0
+ description: >-
+ OAS 3.0.1 definition of the Fault Supervision MnS
+ © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).
+ All rights reserved.
+externalDocs:
+ description: 3GPP TS 28.532 V16.4.0; Generic management services
+ url: http://www.3gpp.org/ftp/Specs/archive/28_series/28.532/
+servers:
+ - url: '{MnSRoot}/FaultSupervisionMnS/{version}'
+ variables:
+ MnSRoot:
+ description: See subclause 4.4.3 of TS 32.158
+ default: http://example.com/3GPPManagement
+ version:
+ description: Versi on number of the OpenAPI definition
+ default: XXX
+paths:
+ /alarms:
+ get:
+ summary: Retrieve multiple alarms
+ description: >-
+ Retrieves the alarms identified by alarmAckState, baseObjectInstance
+ and filter.
+ parameters:
+ - name: alarmAckState
+ in: query
+ required: false
+ schema:
+ $ref: '#/components/schemas/AlarmAckState'
+ - name: baseObjectInstance
+ in: query
+ required: false
+ schema:
+ $ref: '#/components/schemas/Dn'
+ - name: filter
+ in: query
+ required: false
+ schema:
+ $ref: '#/components/schemas/Filter'
+ responses:
+ '200':
+ description: >-
+ Success case ("200 OK").
+ Returns the alarms identified in the request. The alarmId is the key
+ of the map.
+ content:
+ application/json:
+ schema:
+ type: object
+ additionalProperties:
+ type: object
+ allOf:
+ - type: object
+ properties:
+ lastNotificationHeader:
+ $ref: '#/components/schemas/NotificationHeader'
+ - $ref: '#/components/schemas/AlarmRecord'
+ - type: object
+ properties:
+ comments:
+ $ref: '#/components/schemas/Comments'
+ default:
+ description: Response in case of error.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ patch:
+ summary: 'Clear, acknowledge or unacknowledge multiple alarms'
+ description: >-
+ Clears, acknowledges or unacknowledges multiple alarms using patch. Depending
+ on which action is to be performed, different merge patch documents need
+ to be used.
+ requestBody:
+ description: >-
+ Patch documents for acknowledging and unacknowledging, or clearing multiple
+ alarms. The keys in the map are the alarmIds to be patched.
+ content:
+ application/merge-patch+json:
+ schema:
+ oneOf:
+ - type: object
+ additionalProperties:
+ $ref: '#/components/schemas/MergePatchAcknowledgeAlarm'
+ - type: object
+ additionalProperties:
+ $ref: '#/components/schemas/MergePatchClearAlarm'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No content").
+ The response message body is empty.
+ default:
+ description: Response in case of error.
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/FailedAlarm'
+ /alarms/alarmCount:
+ get:
+ summary: Get the alarm count per perceived severity
+ parameters:
+ - name: alarmAckState
+ in: query
+ required: false
+ schema:
+ $ref: '#/components/schemas/AlarmAckState'
+ - name: filter
+ in: query
+ required: false
+ schema:
+ type: string
+ responses:
+ '200':
+ description: >-
+ Success case ("200 OK").
+ The alarm count per perceived severity is returned.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/AlarmCount'
+ default:
+ description: Response in case of error. The error case needs rework.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ /alarms/{alarmId}:
+ patch:
+ summary: 'Clear, acknowledge or unacknowledge a single alarm'
+ description: >-
+ Clears, acknowledges or uncknowldeges a single alarm by patching the alarm
+ information. A conditional acknowledge request based on the perceived
+ severity is not supported.
+ parameters:
+ - name: alarmId
+ in: path
+ description: Identifies the alarm to be patched.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ required: true
+ content:
+ application/merge-patch+json:
+ schema:
+ oneOf:
+ - $ref: '#/components/schemas/MergePatchAcknowledgeAlarm'
+ - $ref: '#/components/schemas/MergePatchClearAlarm'
+ responses:
+ '204':
+ description: >-
+ Success case (204 No content).
+ The response message body is absent.
+ default:
+ description: Response in case of error.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ /alarms/{alarmId}/comments:
+ post:
+ summary: Add a comment to a single alarm
+ description: >-
+ Adds a comment to an alarm identified by alarmId. The id of the new comment
+ is allocated by the producer.
+ parameters:
+ - name: alarmId
+ in: path
+ description: Identifies the alarm to which the comment shall be added.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Comment'
+ responses:
+ '201':
+ description: >-
+ Success case (201 Created).
+ The representation of the newly created comment resource shall be returned.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Comment'
+ headers:
+ Location:
+ description: URI of the newly created comment resource.
+ required: true
+ schema:
+ type: string
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+
+ /subscriptions:
+ post:
+ summary: Create a subscription
+ description: >-
+ To create a subscription the representation of the subscription is
+ POSTed on the /subscriptions collection resource.
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Subscription'
+ responses:
+ '201':
+ description: >-
+ Success case ("201 Created").
+ The representation of the newly created subscription resource shall
+ be returned.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Subscription'
+ headers:
+ Location:
+ description: URI of the newly created subscription resource
+ required: true
+ schema:
+ type: string
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ callbacks:
+ notifyNewAlarm:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ oneOf:
+ - $ref: '#/components/schemas/NotifyNewAlarm'
+ - $ref: '#/components/schemas/NotifyNewSecAlarm'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyClearedAlarm:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NotifyClearedAlarm'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyChangedAlarm:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NotifyChangedAlarm'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyChangedAlarmGeneral:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ oneOf:
+ - $ref: '#/components/schemas/NotifyChangedAlarmGeneral'
+ - $ref: '#/components/schemas/NotifyChangedSecAlarmGeneral'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyCorrelatedNotificationChanged:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NotifyCorrelatedNotificationChanged'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyAckStateChanged:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NotifyAckStateChanged'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyComments:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NotifyComments'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyPotentialFaultyAlarmList:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NotifyPotentialFaultyAlarmList'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ notifyAlarmListRebuilt:
+ '{request.body#/consumerReference}':
+ post:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/NotifyAlarmListRebuilt'
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The notification is successfully delivered. The response message
+ body is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+ /subscriptions/{subscriptionId}:
+ delete:
+ summary: Delete a subscription
+ description: >-
+ The subscription is deleted by deleting the corresponding subscription
+ resource. The resource to be deleted is identified with the path
+ component of the URI.
+ parameters:
+ - name: subscriptionId
+ in: path
+ description: Identifies the subscription to be deleted.
+ required: true
+ schema:
+ type: string
+ responses:
+ '204':
+ description: >-
+ Success case ("204 No Content").
+ The subscription resource has been deleted. The response message body
+ is absent.
+ default:
+ description: Error case.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ErrorResponse'
+
+components:
+ schemas:
+
+ #---- Definitions to be moved to comDefs.yaml --------------------------------------#
+
+ Long:
+ type: string
+ format: long
+ Float:
+ type: string
+ format: float
+ DateTime:
+ type: string
+ format: date-Time
+
+ Dn:
+ type: string
+ Uri:
+ type: string
+
+ AttributeNameValuePairSet:
+ type: object
+ minProperties: 1
+ AttributeValueChangeSet:
+ description: >-
+ The key in this map is the attribute name. The value of each key is an array.
+ When only one item is present in the array, it carries the new attribute
+ value. If two items are present, then the first item carries the old value
+ and the second item the new value. The items can be of any type including null.
+ type: object
+ additionalProperties:
+ type: array
+ minItems: 1
+ maxItems: 2
+ items:
+ nullable: true
+
+ Filter:
+ type: string
+ SystemDN:
+ type: string
+
+ NotificationId:
+ type: integer
+ NotificationHeader:
+ description: >-
+ Header used for all notification types
+ type: object
+ required:
+ - href
+ - notificationId
+ - notificationType
+ - eventTime
+ - systemDN
+ properties:
+ uri:
+ $ref: '#/components/schemas/Uri'
+ notificationId:
+ $ref: '#/components/schemas/NotificationId'
+ notificationType:
+ oneOf:
+ - $ref: '#/components/schemas/AlarmNotificationTypes'
+ #- $ref: 'faultMnS.yaml#/components/schemas/AlarmNotificationTypes'
+ #- $ref: 'provMnS.yaml#/components/schemas/CmNotificationTypes'
+ # more to be added
+ eventTime:
+ $ref: '#/components/schemas/DateTime'
+ systemDN:
+ $ref: '#/components/schemas/SystemDN'
+
+ ErrorResponse:
+ description: >-
+ Default schema for the response message body in case the request is not
+ successful.
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ errorInfo:
+ type: string
+
+ #---- End of definitions to be moved to comDefs.yaml -------------------------------#
+
+ #---- Definition of AlarmRecord ----------------------------------------------------#
+
+ AlarmId:
+ type: string
+ AlarmType:
+ type: string
+ enum:
+ - COMMUNICATIONS_ALARM
+ - QUALITY_OF_SERVICE_ALARM
+ - PROCESSING_ERROR_ALARM
+ - EQUIPMENT_ALARM
+ - ENVIRONMENTAL_ALARM
+ - INTEGRITY_VIOLATION
+ - OPERATIONAL_VIOLATION
+ - PHYSICAL_VIOLATION
+ - SECURITY_SERVICE_OR_MECHANISM_VIOLATION
+ - TIME_DOMAIN_VIOLATION
+ ProbableCause:
+ description: >-
+ The value of the probable cause may be a specific standardized string, or any
+ vendor provided string. Probable cause strings are not standardized in the
+ present document. They may be added in a future version. Up to then the
+ mapping of the generic probable cause strings "PROBABLE_CAUSE_001" to
+ "PROBABLE_CAUSE_005" is vendor specific.
+ The value of the probable cause may also be an integer. The mapping of integer
+ values to probable causes is vendor specific.
+ oneOf:
+ - anyOf:
+ - type: string
+ enum:
+ - PROBABLE_CAUSE_001
+ - PROBABLE_CAUSE_002
+ - PROBABLE_CAUSE_003
+ - PROBABLE_CAUSE_004
+ - PROBABLE_CAUSE_005
+ - type: string
+ - type: integer
+ SpecificProblem:
+ oneOf:
+ - type: string
+ - type: integer
+ PerceivedSeverity:
+ type: string
+ enum:
+ - INDETERMINATE
+ - CRITICAL
+ - MAJOR
+ - MINOR
+ - WARNING
+ - CLEARED
+ TrendIndication:
+ type: string
+ enum:
+ - MORE_SEVERE
+ - NO_CHANGE
+ - LESS_SEVERE
+ ThresholdHysteresis:
+ type: object
+ required:
+ - high
+ properties:
+ high:
+ oneOf:
+ - type: integer
+ - $ref: '#/components/schemas/Float'
+ low:
+ $ref: '#/components/schemas/Float'
+ ThresholdLevelInd:
+ type: object
+ required:
+ - up
+ properties:
+ up:
+ $ref: '#/components/schemas/ThresholdHysteresis'
+ low:
+ $ref: '#/components/schemas/ThresholdHysteresis'
+ ThresholdInfo:
+ type: object
+ required:
+ - observedMeasurement
+ - observedValue
+ properties:
+ observedMeasurement:
+ type: string
+ observedValue:
+ oneOf:
+ - type: integer
+ - $ref: '#/components/schemas/Float'
+ thresholdLevelInd:
+ $ref: '#/components/schemas/ThresholdLevelInd'
+ armTime:
+ $ref: '#/components/schemas/DateTime'
+ CorrelatedNotification:
+ type: object
+ required:
+ - source
+ - notificationId
+ properties:
+ sourceObjectInstance:
+ $ref: '#/components/schemas/Dn'
+ notificationIds:
+ type: array
+ items:
+ $ref: '#/components/schemas/NotificationId'
+ CorrelatedNotifications:
+ type: array
+ items:
+ $ref: '#/components/schemas/CorrelatedNotification'
+ AckState:
+ type: string
+ enum:
+ - ACKNOWLEDGED
+ - UNACKNOWLEDGED
+
+ AlarmRecord:
+ description: >-
+ The alarmId is not a property of an alarm record. It is used as key
+ in the map of alarm records instead.
+ type: object
+ properties:
+ # alarmId:
+ # $ref: '#/components/schemas/AlarmId'
+ objectInstance:
+ $ref: '#/components/schemas/Dn'
+ notificationId:
+ $ref: '#/components/schemas/NotificationId'
+ alarmRaisedTime:
+ $ref: '#/components/schemas/DateTime'
+ alarmChangedTime:
+ $ref: '#/components/schemas/DateTime'
+ alarmClearedTime:
+ $ref: '#/components/schemas/DateTime'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ specificProblem:
+ $ref: '#/components/schemas/SpecificProblem'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ backedUpStatus:
+ type: boolean
+ backUpObject:
+ $ref: '#/components/schemas/Dn'
+ trendIndication:
+ $ref: '#/components/schemas/TrendIndication'
+ thresholdinfo:
+ $ref: '#/components/schemas/ThresholdInfo'
+ correlatedNotifications:
+ $ref: '#/components/schemas/CorrelatedNotifications'
+ stateChangeDefinition:
+ $ref: '#/components/schemas/AttributeValueChangeSet'
+ monitoredAttributes:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ proposedRepairActions:
+ type: string
+ additionalText:
+ type: string
+ additionalInformation:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+
+ rootCauseIndicator:
+ type: boolean
+
+ ackTime:
+ $ref: '#/components/schemas/DateTime'
+ ackUserId:
+ type: string
+ ackSystemId:
+ type: string
+ ackState:
+ $ref: '#/components/schemas/AckState'
+
+ clearUserId:
+ type: string
+ clearSystemId:
+ type: string
+ serviceUser:
+ type: string
+ serviceProvider:
+ type: string
+ securityAlarmDetector:
+ type: string
+
+ #---- Definition of alarm notifications --------------------------------------------#
+
+ AlarmNotificationTypes:
+ type: string
+ enum:
+ - notifyNewAlarm
+ - notifyChangedAlarm
+ - notifyChangedAlarmGeneral
+ - notifyAckStateChanged
+ - notifyCorrelatedNotificationChanged
+ - notifyComments
+ - notifyClearedAlarm
+ - notifyAlarmListRebuiltAlarm
+ - notifyPotentialFaultyAlarmList
+ AlarmListAlignmentRequirement:
+ type: string
+ enum:
+ - ALIGNMENT_REQUIRED
+ - ALIGNMENT_NOT_REQUIRED
+
+ NotifyNewAlarm:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ specificProblem:
+ $ref: '#/components/schemas/SpecificProblem'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ backedUpStatus:
+ type: boolean
+ backUpObject:
+ $ref: '#/components/schemas/Dn'
+ trendIndication:
+ $ref: '#/components/schemas/TrendIndication'
+ thresholdInfo:
+ $ref: '#/components/schemas/ThresholdInfo'
+ correlatedNotifications:
+ $ref: '#/components/schemas/CorrelatedNotifications'
+ stateChangeDefinition:
+ $ref: '#/components/schemas/AttributeValueChangeSet'
+ monitoredAttributes:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ proposedRepairActions:
+ type: string
+ additionalText:
+ type: string
+ additionalInformation:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ rootCauseIndicator:
+ type: boolean
+ NotifyNewSecAlarm:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ - serviceUser
+ - serviceProvider
+ - securityAlarmDetector
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ correlatedNotifications:
+ $ref: '#/components/schemas/CorrelatedNotifications'
+ additionalText:
+ type: string
+ additionalInformation:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ rootCauseIndicator:
+ type: boolean
+ serviceUser:
+ type: string
+ serviceProvider:
+ type: string
+ securityAlarmDetector:
+ type: string
+ NotifyClearedAlarm:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ correlatedNotifications:
+ $ref: '#/components/schemas/CorrelatedNotifications'
+ clearUserId:
+ type: string
+ clearSystemId:
+ type: string
+ NotifyChangedAlarm:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ NotifyChangedAlarmGeneral:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ - changedAlarmAttributes
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ specificProblem:
+ $ref: '#/components/schemas/SpecificProblem'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ correlatedNotifications:
+ $ref: '#/components/schemas/CorrelatedNotifications'
+ backedUpStatus:
+ type: boolean
+ backUpObject:
+ $ref: '#/components/schemas/Dn'
+ trendIndication:
+ $ref: '#/components/schemas/TrendIndication'
+ thresholdInfo:
+ $ref: '#/components/schemas/ThresholdInfo'
+ stateChangeDefinition:
+ $ref: '#/components/schemas/AttributeValueChangeSet'
+ monitoredAttributes:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ proposedRepairActions:
+ type: string
+ additionalText:
+ type: string
+ additionalInformation:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ rootCauseIndicator:
+ type: boolean
+ changedAlarmAttributes:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ NotifyChangedSecAlarmGeneral:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ - serviceUser
+ - serviceProvider
+ - securityAlarmDetector
+ - changedAlarmAttributes
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ correlatedNotifications:
+ $ref: '#/components/schemas/CorrelatedNotifications'
+ additionalText:
+ type: string
+ additionalInformation:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ rootCauseIndicator:
+ type: boolean
+ serviceUser:
+ type: string
+ serviceProvider:
+ type: string
+ securityAlarmDetector:
+ type: string
+ changedAlarmAttributes:
+ $ref: '#/components/schemas/AttributeNameValuePairSet'
+ NotifyCorrelatedNotificationChanged:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - correlatedNotifications
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ correlatedNotifications:
+ $ref: '#/components/schemas/CorrelatedNotifications'
+ rootCauseIndicator:
+ type: boolean
+ NotifyAckStateChanged:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ - ackState
+ - ackUserId
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ ackState:
+ $ref: '#/components/schemas/AckState'
+ ackUserId:
+ type: string
+ ackSystemId:
+ type: string
+ NotifyComments:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - alarmId
+ - alarmType
+ - probableCause
+ - perceivedSeverity
+ - comments
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ alarmType:
+ $ref: '#/components/schemas/AlarmType'
+ probableCause:
+ $ref: '#/components/schemas/ProbableCause'
+ perceivedSeverity:
+ $ref: '#/components/schemas/PerceivedSeverity'
+ comments:
+ $ref: '#/components/schemas/Comments'
+ NotifyPotentialFaultyAlarmList:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - reason
+ properties:
+ reason:
+ type: string
+ NotifyAlarmListRebuilt:
+ allOf:
+ - $ref: '#/components/schemas/NotificationHeader'
+ - type: object
+ required:
+ - reason
+ properties:
+ reason:
+ type: string
+ alarmListAlignmentRequirement:
+ $ref: '#/components/schemas/AlarmListAlignmentRequirement'
+
+ #---- Definition of query parameters -----------------------------------------------#
+
+ AlarmAckState:
+ type: string
+ enum:
+ - ALL_ALARMS
+ - ALL_ACTIVE_ALARMS
+ - ALL_ACTIVE_AND_ACKNOWLEDGED_ALARMS
+ - ALL_ACTIVE_AND_UNACKNOWLEDGED_ALARMS
+ - ALL_CLEARED_AND_UNACKNOWLEDGED_ALARMS
+ - ALL_UNACKNOWLEDGED_ALARMS
+
+ #---- Definition of patch documents ------------------------------------------------#
+
+ MergePatchAcknowledgeAlarm:
+ description: >-
+ Patch document acknowledging or unacknowledging a single alarm. For
+ acknowleding an alarm the value of ackState is ACKNOWLEDGED, for unacknowleding
+ an alarm the value of ackState is UNACKNOWLEDGED.
+ type: object
+ required:
+ - ackUserId
+ - ackState
+ properties:
+ ackUserId:
+ type: string
+ ackSystemId:
+ type: string
+ ackState:
+ $ref: '#/components/schemas/AckState'
+ MergePatchClearAlarm:
+ description: Patch document for clearing a single alarm
+ type: object
+ required:
+ - clearUserId
+ - perceivedSeverity
+ properties:
+ clearUserId:
+ type: string
+ clearSystemId:
+ type: string
+ perceivedSeverity:
+ type: string
+ enum:
+ - CLEARED
+
+ #---- Definition of method responses -----------------------------------------------#
+
+ FailedAlarm:
+ type: object
+ required:
+ - alarmId
+ - failureReason
+ properties:
+ alarmId:
+ $ref: '#/components/schemas/AlarmId'
+ failureReason:
+ type: string
+
+ #---- Definition of resources ------------------------------------------------------#
+
+ AlarmCount:
+ type: object
+ required:
+ - criticalCount
+ - majorCount
+ - minorCount
+ - warningCount
+ - indeterminateCount
+ - clearedCount
+ properties:
+ criticalCount:
+ type: integer
+ majorCount:
+ type: integer
+ minorCount:
+ type: integer
+ warningCount:
+ type: integer
+ indeterminateCount:
+ type: integer
+ clearedCount:
+ type: integer
+ Comment:
+ type: object
+ properties:
+ commentTime:
+ $ref: '#/components/schemas/DateTime'
+ commentUserId:
+ type: string
+ commentSystemId:
+ type: string
+ commentText:
+ type: string
+ Comments:
+ description: >-
+ Collection of comments. The comment identifiers are allocated by the
+ MnS producer and used as key in the map.
+ type: object
+ additionalProperties:
+ $ref: '#/components/schemas/Comment'
+ Subscription:
+ type: object
+ properties:
+ consumerReference:
+ $ref: '#/components/schemas/Uri'
+ timeTick:
+ $ref: '#/components/schemas/Long'
+ filter:
+ $ref: '#/components/schemas/Filter'
diff --git a/src/test/resources/stndDefined/schema-map.json b/src/test/resources/stndDefined/schema-map.json
new file mode 100644
index 00000000..6d19037c
--- /dev/null
+++ b/src/test/resources/stndDefined/schema-map.json
@@ -0,0 +1,6 @@
+[
+ {
+ "publicURL": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml",
+ "localURL": "OpenAPI_faultMnS.yaml"
+ }
+] \ No newline at end of file
diff --git a/src/test/resources/ves7_batch_with_stndDefined_valid.json b/src/test/resources/ves7_batch_with_stndDefined_valid.json
new file mode 100644
index 00000000..10ab4b49
--- /dev/null
+++ b/src/test/resources/ves7_batch_with_stndDefined_valid.json
@@ -0,0 +1,109 @@
+{
+ "eventList": [
+ {
+ "commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
+ "domain": "stndDefined",
+ "eventId": "stndDefined-gNB_Nokia000001",
+ "eventName": "stndDefined-gNB-Nokia-PowerLost",
+ "stndDefinedNamespace": "3GPP-FaultSupervision",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
+ },
+ "stndDefinedFields": {
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm",
+ "data": {
+ "href": 1,
+ "uri": "1",
+ "notificationId": 1,
+ "notificationType": "notifyNewAlarm",
+ "eventTime": "xyz",
+ "systemDN": "xyz",
+ "probableCause": 1,
+ "perceivedSeverity": "INDETERMINATE",
+ "rootCauseIndicator": false,
+ "specificProblem": "xyz",
+ "correlatedNotifications": [],
+ "backedUpStatus": true,
+ "backUpObject": "xyz",
+ "trendIndication": "MORE_SEVERE",
+ "thresholdInfo": {
+ "observedMeasurement": "new",
+ "observedValue": 123
+ },
+ "stateChangeDefinition": {
+ },
+ "monitoredAttributes": {
+ "newAtt": "new"
+ },
+ "proposedRepairActions": "xyz",
+ "additionalText": "xyz",
+ "additionalInformation": {
+ "addInfo": "new"
+ },
+ "alarmId": "1",
+ "alarmType": "COMMUNICATIONS_ALARM"
+ },
+ "stndDefinedFieldsVersion": "1.0"
+ }
+ },
+ {
+ "commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
+ "domain": "stndDefined",
+ "eventId": "stndDefined-gNB_Nokia000001",
+ "eventName": "stndDefined-gNB-Nokia-PowerLost",
+ "stndDefinedNamespace": "3GPP-FaultSupervision",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
+ },
+ "stndDefinedFields": {
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm",
+ "data": {
+ "href": 1,
+ "uri": "1",
+ "notificationId": 1,
+ "notificationType": "notifyNewAlarm",
+ "eventTime": "xyz",
+ "systemDN": "xyz",
+ "probableCause": 1,
+ "perceivedSeverity": "INDETERMINATE",
+ "rootCauseIndicator": false,
+ "specificProblem": "xyz",
+ "correlatedNotifications": [],
+ "backedUpStatus": true,
+ "backUpObject": "xyz",
+ "trendIndication": "MORE_SEVERE",
+ "thresholdInfo": {
+ "observedMeasurement": "new",
+ "observedValue": 123
+ },
+ "stateChangeDefinition": {
+ },
+ "monitoredAttributes": {
+ "newAtt": "new"
+ },
+ "proposedRepairActions": "xyz",
+ "additionalText": "xyz",
+ "additionalInformation": {
+ "addInfo": "new"
+ },
+ "alarmId": "1",
+ "alarmType": "COMMUNICATIONS_ALARM"
+ },
+ "stndDefinedFieldsVersion": "1.0"
+ }
+ }
+ ]
+}
+
diff --git a/src/test/resources/ves7_valid_eventWithStndDefinedFields.json b/src/test/resources/ves7_valid_eventWithStndDefinedFields.json
deleted file mode 100644
index 5d40b9d9..00000000
--- a/src/test/resources/ves7_valid_eventWithStndDefinedFields.json
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "event": {
- "commonEventHeader": {
- "domain": "stndDefined",
- "eventId": "stndDefined-gNB_Nokia000001",
- "eventName": "stndDefined-gNB-Nokia-PowerLost",
- "stndDefinedNamespace": "3GPP-FaultSupervision",
- "lastEpochMicrosec": 1234567890,
- "priority": "Normal",
- "reportingEntityName": "Nokia123456",
- "sequence": 0,
- "sourceName": "Nokia123456",
- "startEpochMicrosec": 1234567890,
- "version": "4.1",
- "vesEventListenerVersion": "7.2"
- },
- "stndDefinedFields": {
- "schemaReference": "https://www.3gpp.org/Rel-16/TS28532_generic_fault_supervision.json#definitions/schemas/notifyNewAlarm-NotifType",
- "data": {
- "header": {
- "uri": "xyz",
- "notificationId": "xyz",
- "notificationType": "notifyNewAlarm",
- "eventTime": "xyz",
- "systemDN": "xyz"
- },
- "body": {
- "probableCause": "xyz",
- "perceivedSeverity": "Major",
- "rootCauseIndicator": false,
- "specificProblem": "xyz",
- "correlatedNotifications": [],
- "backedUpStatus": true,
- "backUpObject": "xyz",
- "trendIndication": "No change",
- "thresholdInfo": {},
- "stateChangeDefinition": [],
- "monitoredAttributes": [],
- "proposedRepairActions": "xyz",
- "additionalText": "xyz",
- "additionalInformation": [],
- "alarmId": "xyz",
- "alarmType": "Environmental Alarm"
- }
- },
- "stndDefinedFieldsVersion": "1.0"
- }
- }
-} \ No newline at end of file
diff --git a/src/test/resources/ves_stdnDefined_empty_namespace_invalid.json b/src/test/resources/ves_stdnDefined_empty_namespace_invalid.json
index bf5f0953..a63bca17 100644
--- a/src/test/resources/ves_stdnDefined_empty_namespace_invalid.json
+++ b/src/test/resources/ves_stdnDefined_empty_namespace_invalid.json
@@ -15,7 +15,7 @@
"vesEventListenerVersion": "7.2"
},
"stndDefinedFields": {
- "schemaReference": "https://www.3gpp.org/Rel-16/TS28532_generic_fault_supervision.json#definitions/schemas/notifyNewAlarm-NotifType",
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#definitions/schemas/notifyNewAlarm-NotifType",
"data": {
"uri": "xyz",
"notificationId": "xyz",
diff --git a/src/test/resources/ves_stdnDefined_invalid.json b/src/test/resources/ves_stdnDefined_invalid.json
new file mode 100644
index 00000000..fce300ae
--- /dev/null
+++ b/src/test/resources/ves_stdnDefined_invalid.json
@@ -0,0 +1,54 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
+ "domain": "stndDefined",
+ "eventId": "stndDefined-gNB_Nokia000001",
+ "eventName": "stndDefined-gNB-Nokia-PowerLost",
+ "stndDefinedNamespace": "3GPP-FaultSupervision",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
+ },
+ "stndDefinedFields": {
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm",
+ "data": {
+ "href": 1,
+ "uri": "1",
+ "notificationId": 1,
+ "notificationType": "notifyNewAlarm",
+ "eventTime": "xyz",
+ "systemDN": "xyz",
+ "probableCause": 1,
+ "perceivedSeverity": 1,
+ "rootCauseIndicator": false,
+ "specificProblem": "xyz",
+ "correlatedNotifications": [],
+ "backedUpStatus": true,
+ "backUpObject": "xyz",
+ "trendIndication": "123",
+ "thresholdInfo": {
+ "observedMeasurement": "new",
+ "observedValue": 123
+ },
+ "stateChangeDefinition": {
+ },
+ "monitoredAttributes": {
+ "newAtt": "new"
+ },
+ "proposedRepairActions": "xyz",
+ "additionalText": "xyz",
+ "additionalInformation": {
+ "addInfo": "new"
+ },
+ "alarmId": 1,
+ "alarmType": "COMMUNICATIONS_ALARM"
+ },
+ "stndDefinedFieldsVersion": "1.0"
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/ves_stdnDefined_missing_local_schema_reference.json b/src/test/resources/ves_stdnDefined_missing_local_schema_reference.json
new file mode 100644
index 00000000..1ee36532
--- /dev/null
+++ b/src/test/resources/ves_stdnDefined_missing_local_schema_reference.json
@@ -0,0 +1,54 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
+ "domain": "stndDefined",
+ "eventId": "stndDefined-gNB_Nokia000001",
+ "eventName": "stndDefined-gNB-Nokia-PowerLost",
+ "stndDefinedNamespace": "3GPP-FaultSupervision",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
+ },
+ "stndDefinedFields": {
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml",
+ "data": {
+ "href": 1,
+ "uri": "1",
+ "notificationId": 1,
+ "notificationType": "notifyNewAlarm",
+ "eventTime": "xyz",
+ "systemDN": "xyz",
+ "probableCause": 1,
+ "perceivedSeverity": "INDETERMINATE",
+ "rootCauseIndicator": false,
+ "specificProblem": "xyz",
+ "correlatedNotifications": [],
+ "backedUpStatus": true,
+ "backUpObject": "xyz",
+ "trendIndication": "MORE_SEVERE",
+ "thresholdInfo": {
+ "observedMeasurement": "new",
+ "observedValue": 123
+ },
+ "stateChangeDefinition": {
+ },
+ "monitoredAttributes": {
+ "newAtt": "new"
+ },
+ "proposedRepairActions": "xyz",
+ "additionalText": "xyz",
+ "additionalInformation": {
+ "addInfo": "new"
+ },
+ "alarmId": "1",
+ "alarmType": "COMMUNICATIONS_ALARM"
+ },
+ "stndDefinedFieldsVersion": "1.0"
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/ves_stdnDefined_missing_namespace_invalid.json b/src/test/resources/ves_stdnDefined_missing_namespace_invalid.json
index 230dc54e..7a35286d 100644
--- a/src/test/resources/ves_stdnDefined_missing_namespace_invalid.json
+++ b/src/test/resources/ves_stdnDefined_missing_namespace_invalid.json
@@ -14,7 +14,7 @@
"vesEventListenerVersion": "7.2"
},
"stndDefinedFields": {
- "schemaReference": "https://www.3gpp.org/Rel-16/TS28532_generic_fault_supervision.json#definitions/schemas/notifyNewAlarm-NotifType",
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#definitions/schemas/notifyNewAlarm-NotifType",
"data": {
"uri": "xyz",
"notificationId": "xyz",
diff --git a/src/test/resources/ves_stdnDefined_valid.json b/src/test/resources/ves_stdnDefined_valid.json
index aa026e71..99b7ce37 100644
--- a/src/test/resources/ves_stdnDefined_valid.json
+++ b/src/test/resources/ves_stdnDefined_valid.json
@@ -1,45 +1,54 @@
{
"event": {
"commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
"domain": "stndDefined",
"eventId": "stndDefined-gNB_Nokia000001",
"eventName": "stndDefined-gNB-Nokia-PowerLost",
"stndDefinedNamespace": "3GPP-FaultSupervision",
- "lastEpochMicrosec": 1234567890,
- "priority": "Normal",
- "reportingEntityName": "Nokia123456",
- "sequence": 0,
- "sourceName": "Nokia123456",
- "startEpochMicrosec": 1234567890,
- "version": "4.1",
- "vesEventListenerVersion": "7.2"
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
},
"stndDefinedFields": {
- "schemaReference": "https://www.3gpp.org/Rel-16/TS28532_generic_fault_supervision.json#definitions/schemas/notifyNewAlarm-NotifType",
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm",
"data": {
- "uri": "xyz",
- "notificationId": "xyz",
+ "href": 1,
+ "uri": "1",
+ "notificationId": 1,
"notificationType": "notifyNewAlarm",
"eventTime": "xyz",
"systemDN": "xyz",
- "probableCause": "xyz",
- "perceivedSeverity": "Major",
+ "probableCause": 1,
+ "perceivedSeverity": "INDETERMINATE",
"rootCauseIndicator": false,
"specificProblem": "xyz",
"correlatedNotifications": [],
"backedUpStatus": true,
"backUpObject": "xyz",
- "trendIndication": "No change",
- "thresholdInfo": {},
- "stateChangeDefinition": [],
- "monitoredAttributes": [],
+ "trendIndication": "MORE_SEVERE",
+ "thresholdInfo": {
+ "observedMeasurement": "new",
+ "observedValue": 123
+ },
+ "stateChangeDefinition": {
+ },
+ "monitoredAttributes": {
+ "newAtt": "new"
+ },
"proposedRepairActions": "xyz",
"additionalText": "xyz",
- "additionalInformation": [],
- "alarmId": "xyz",
- "alarmType": "Environmental Alarm"
+ "additionalInformation": {
+ "addInfo": "new"
+ },
+ "alarmId": "1",
+ "alarmType": "COMMUNICATIONS_ALARM"
},
"stndDefinedFieldsVersion": "1.0"
}
}
-}
+} \ No newline at end of file
diff --git a/src/test/resources/ves_stdnDefined_with_empty_stndDefined_fields_data.json b/src/test/resources/ves_stdnDefined_with_empty_stndDefined_fields_data.json
new file mode 100644
index 00000000..2d91c438
--- /dev/null
+++ b/src/test/resources/ves_stdnDefined_with_empty_stndDefined_fields_data.json
@@ -0,0 +1,24 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
+ "domain": "stndDefined",
+ "eventId": "stndDefined-gNB_Nokia000001",
+ "eventName": "stndDefined-gNB-Nokia-PowerLost",
+ "stndDefinedNamespace": "3GPP-FaultSupervision",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
+ },
+ "stndDefinedFields": {
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#components/schemas/NotifyNewAlarm",
+ "data": {
+ },
+ "stndDefinedFieldsVersion": "1.0"
+ }
+ }
+}
diff --git a/src/test/resources/ves_stdnDefined_without_schema_reference.json b/src/test/resources/ves_stdnDefined_without_schema_reference.json
new file mode 100644
index 00000000..33342c6c
--- /dev/null
+++ b/src/test/resources/ves_stdnDefined_without_schema_reference.json
@@ -0,0 +1,22 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
+ "domain": "stndDefined",
+ "eventId": "stndDefined-gNB_Nokia000001",
+ "eventName": "stndDefined-gNB-Nokia-PowerLost",
+ "stndDefinedNamespace": "3GPP-FaultSupervision",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
+ },
+ "stndDefinedFields": {
+ "data": {},
+ "stndDefinedFieldsVersion": "1.0"
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/ves_stdnDefined_wrong_internal_file_reference.json b/src/test/resources/ves_stdnDefined_wrong_internal_file_reference.json
new file mode 100644
index 00000000..9e835443
--- /dev/null
+++ b/src/test/resources/ves_stdnDefined_wrong_internal_file_reference.json
@@ -0,0 +1,54 @@
+{
+ "event": {
+ "commonEventHeader": {
+ "version": "4.1",
+ "vesEventListenerVersion": "7.2",
+ "domain": "stndDefined",
+ "eventId": "stndDefined-gNB_Nokia000001",
+ "eventName": "stndDefined-gNB-Nokia-PowerLost",
+ "stndDefinedNamespace": "3GPP-FaultSupervision",
+ "startEpochMicrosec": 1413378172000000,
+ "lastEpochMicrosec": 1413378172000000,
+ "reportingEntityName": "ibcx0001vm002oam001",
+ "sourceName": "scfx0001vm002cap001",
+ "sequence": 1,
+ "priority": "High"
+ },
+ "stndDefinedFields": {
+ "schemaReference": "https://forge.3gpp.org/rep/sa5/data-models/blob/REL-16/OpenAPI/faultMnS.yaml#components/schemas/dummyRef",
+ "data": {
+ "href": 1,
+ "uri": "1",
+ "notificationId": 1,
+ "notificationType": "notifyNewAlarm",
+ "eventTime": "xyz",
+ "systemDN": "xyz",
+ "probableCause": 1,
+ "perceivedSeverity": "INDETERMINATE",
+ "rootCauseIndicator": false,
+ "specificProblem": "xyz",
+ "correlatedNotifications": [],
+ "backedUpStatus": true,
+ "backUpObject": "xyz",
+ "trendIndication": "MORE_SEVERE",
+ "thresholdInfo": {
+ "observedMeasurement": "new",
+ "observedValue": 123
+ },
+ "stateChangeDefinition": {
+ },
+ "monitoredAttributes": {
+ "newAtt": "new"
+ },
+ "proposedRepairActions": "xyz",
+ "additionalText": "xyz",
+ "additionalInformation": {
+ "addInfo": "new"
+ },
+ "alarmId": "1",
+ "alarmType": "COMMUNICATIONS_ALARM"
+ },
+ "stndDefinedFieldsVersion": "1.0"
+ }
+ }
+} \ No newline at end of file