diff options
19 files changed, 64 insertions, 34 deletions
diff --git a/hv-collector-analysis/pom.xml b/hv-collector-analysis/pom.xml index 8ea66005..6c45a9f4 100644 --- a/hv-collector-analysis/pom.xml +++ b/hv-collector-analysis/pom.xml @@ -32,7 +32,7 @@ <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>hv-collector-analysis</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <description>VES HighVolume Collector :: Code analysis configuration</description> <build> diff --git a/hv-collector-core/pom.xml b/hv-collector-core/pom.xml index a893dad6..5a098cca 100644 --- a/hv-collector-core/pom.xml +++ b/hv-collector-core/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt index a4a4374c..05221e45 100644 --- a/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt +++ b/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidator.kt @@ -20,6 +20,7 @@ package org.onap.dcae.collectors.veshv.impl import org.onap.dcae.collectors.veshv.domain.headerRequiredFieldDescriptors +import org.onap.dcae.collectors.veshv.domain.vesEventListenerVersionRegex import org.onap.dcae.collectors.veshv.model.VesMessage import org.onap.ves.VesEventOuterClass.CommonEventHeader @@ -32,4 +33,5 @@ internal object MessageValidator { private fun allMandatoryFieldsArePresent(header: CommonEventHeader) = headerRequiredFieldDescriptors .all { fieldDescriptor -> header.hasField(fieldDescriptor) } + .and(vesEventListenerVersionRegex.matches(header.vesEventListenerVersion)) } diff --git a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt index 443dfa2f..872e67ef 100644 --- a/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt +++ b/hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt @@ -29,10 +29,7 @@ import org.onap.dcae.collectors.veshv.domain.VesEventDomain import org.onap.dcae.collectors.veshv.model.VesMessage import org.onap.dcae.collectors.veshv.tests.utils.commonHeader import org.onap.dcae.collectors.veshv.tests.utils.vesEventBytes - -import org.onap.ves.VesEventOuterClass.CommonEventHeader.Priority -import org.onap.ves.VesEventOuterClass.CommonEventHeader.getDefaultInstance -import org.onap.ves.VesEventOuterClass.CommonEventHeader.newBuilder +import org.onap.ves.VesEventOuterClass.CommonEventHeader.* internal object MessageValidatorTest : Spek({ @@ -96,5 +93,36 @@ internal object MessageValidatorTest : Spek({ assertThat(cut.isValid(vesMessage)).describedAs("message validation result").isFalse() } } + + on("ves hv message including header.vesEventListenerVersion with non-string major part") { + val commonHeader = commonHeader(vesEventListenerVersion = "sample-version") + val rawMessageBytes = vesEventBytes(commonHeader) + + + it("should not accept message header") { + val vesMessage = VesMessage(commonHeader, rawMessageBytes) + assertThat(cut.isValid(vesMessage)).describedAs("message validation result").isFalse() + } + } + + on("ves hv message including header.vesEventListenerVersion with major part != 7") { + val commonHeader = commonHeader(vesEventListenerVersion = "1.2.3") + val rawMessageBytes = vesEventBytes(commonHeader) + + it("should not accept message header") { + val vesMessage = VesMessage(commonHeader, rawMessageBytes) + assertThat(cut.isValid(vesMessage)).describedAs("message validation result").isFalse() + } + } + + on("ves hv message including header.vesEventListenerVersion with minor part not starting with a digit") { + val commonHeader = commonHeader(vesEventListenerVersion = "7.test") + val rawMessageBytes = vesEventBytes(commonHeader) + + it("should not accept message header") { + val vesMessage = VesMessage(commonHeader, rawMessageBytes) + assertThat(cut.isValid(vesMessage)).describedAs("message validation result").isFalse() + } + } } }) diff --git a/hv-collector-coverage/pom.xml b/hv-collector-coverage/pom.xml index 9005fdeb..5ecc6f44 100644 --- a/hv-collector-coverage/pom.xml +++ b/hv-collector-coverage/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-ct/pom.xml b/hv-collector-ct/pom.xml index adb9a69d..4fd021e8 100644 --- a/hv-collector-ct/pom.xml +++ b/hv-collector-ct/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-dcae-app-simulator/pom.xml b/hv-collector-dcae-app-simulator/pom.xml index 5cece3da..21ab2e51 100644 --- a/hv-collector-dcae-app-simulator/pom.xml +++ b/hv-collector-dcae-app-simulator/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-domain/pom.xml b/hv-collector-domain/pom.xml index afc75ed6..e0cd206b 100644 --- a/hv-collector-domain/pom.xml +++ b/hv-collector-domain/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/validation.kt b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/validation.kt index 339a652c..1eb6239f 100644 --- a/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/validation.kt +++ b/hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/validation.kt @@ -24,7 +24,7 @@ import org.onap.ves.VesEventOuterClass val headerRequiredFieldDescriptors = listOf( "version", "domain", - "sequence", + /* field "sequence" has been removed from validation, since default value "0" is acceptable */ "priority", "eventId", "eventName", @@ -34,3 +34,5 @@ val headerRequiredFieldDescriptors = listOf( "sourceName", "vesEventListenerVersion") .map { fieldName -> VesEventOuterClass.CommonEventHeader.getDescriptor().findFieldByName(fieldName) } + +val vesEventListenerVersionRegex = """7\.[0-9].*""".toRegex() diff --git a/hv-collector-domain/src/main/proto/event/VesEvent.proto b/hv-collector-domain/src/main/proto/event/VesEvent.proto index dbe0aa3f..6d4c2307 100644 --- a/hv-collector-domain/src/main/proto/event/VesEvent.proto +++ b/hv-collector-domain/src/main/proto/event/VesEvent.proto @@ -25,21 +25,20 @@ message VesEvent // top-level message, currently the CommonEventHeader commonEventHeader=1; // required bytes eventFields=2; // required, payload - // this field contains a domain-specific GPB message - // the field being opaque (bytes), the decoding of the payload occurs in a separate step - // the name of the GPB message for domain XYZ is XyzFields - // e.g. for domain==perf3gpp, the GPB message is Perf3gppFields + // this field contains a domain-specific GPB message + // the field being opaque (bytes), the decoding of the payload occurs in a separate step + // the name of the GPB message for domain XYZ is XyzFields + // e.g. for domain==perf3gpp, the GPB message is Perf3gppFields } // VES CommonEventHeader adapted to GPB (Google Protocol Buffers) -// Aligned with VES 7.0.1 schema, and extending to Performance Domain. message CommonEventHeader { string version = 1; // required, "version of the gpb common event header", current value "1.0" string domain = 2; // required, "the eventing domain associated with the event", allowed values: - // fault, heartbeat, measurement, mobileFlow, other, pnfRegistration, sipSignaling, - // stateChange, syslog, thresholdCrossingAlert, voiceQuality, perf3gpp + // fault, heartbeat, measurement, mobileFlow, other, pnfRegistration, sipSignaling, + // stateChange, syslog, thresholdCrossingAlert, voiceQuality, perf3gpp uint32 sequence = 3; // required, "ordering of events communicated by an event source instance or 0 if not needed" @@ -69,7 +68,7 @@ message CommonEventHeader bytes sourceId = 15; // "UUID identifying the entity experiencing the event issue; must be populated by the ATT enrichment process" string sourceName = 16; // required, "name of the entity experiencing the event issued use A&AI entry" string timeZoneOffset = 17; // "Offset to GMT to indicate local time zone for the device" - string vesEventListenerVersion = 18; // required, "Version of the VesEvent Listener", current value "7.0.2" + string vesEventListenerVersion = 18; // required, "Version of the VesEvent Listener", current value "7.2" reserved "InternalHeaderFields"; // "enrichment fields for internal VES Event Listener service use only, not supplied by event sources" reserved 100; diff --git a/hv-collector-health-check/pom.xml b/hv-collector-health-check/pom.xml index f66fe9f7..7fbe342e 100644 --- a/hv-collector-health-check/pom.xml +++ b/hv-collector-health-check/pom.xml @@ -19,7 +19,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-main/pom.xml b/hv-collector-main/pom.xml index c07323a8..08a9eea7 100644 --- a/hv-collector-main/pom.xml +++ b/hv-collector-main/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-ssl/pom.xml b/hv-collector-ssl/pom.xml index df3d56eb..9c0a015d 100644 --- a/hv-collector-ssl/pom.xml +++ b/hv-collector-ssl/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-test-utils/pom.xml b/hv-collector-test-utils/pom.xml index 063cf7e1..c751fc3a 100644 --- a/hv-collector-test-utils/pom.xml +++ b/hv-collector-test-utils/pom.xml @@ -14,7 +14,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/vesEvents.kt b/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/vesEvents.kt index 20d0c50f..f3a12ca1 100644 --- a/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/vesEvents.kt +++ b/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/vesEvents.kt @@ -44,7 +44,8 @@ fun vesEvent(commonEventHeader: CommonEventHeader, fun commonHeader(domain: VesEventDomain = PERF3GPP, id: String = randomUUID().toString(), - priority: Priority = Priority.NORMAL): CommonEventHeader = + priority: Priority = Priority.NORMAL, + vesEventListenerVersion: String = "7.2"): CommonEventHeader = CommonEventHeader.newBuilder() .setVersion("sample-version") .setDomain(domain.domainName) @@ -63,10 +64,10 @@ fun commonHeader(domain: VesEventDomain = PERF3GPP, .setSourceId(ByteString.copyFromUtf8("sample-source-id")) .setSourceName("sample-source-name") .setTimeZoneOffset("+1") - .setVesEventListenerVersion("another-version") + .setVesEventListenerVersion(vesEventListenerVersion) .build() fun vesEventBytes(commonHeader: CommonEventHeader, byteString: ByteString = ByteString.EMPTY): ByteData = vesEvent(commonHeader, byteString).toByteData() -fun MessageLite.toByteData(): ByteData = ByteData(toByteArray())
\ No newline at end of file +fun MessageLite.toByteData(): ByteData = ByteData(toByteArray()) diff --git a/hv-collector-utils/pom.xml b/hv-collector-utils/pom.xml index f60ff9b0..55be0017 100644 --- a/hv-collector-utils/pom.xml +++ b/hv-collector-utils/pom.xml @@ -37,7 +37,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-ves-message-generator/pom.xml b/hv-collector-ves-message-generator/pom.xml index 28d407e4..45096fcb 100644 --- a/hv-collector-ves-message-generator/pom.xml +++ b/hv-collector-ves-message-generator/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/hv-collector-xnf-simulator/pom.xml b/hv-collector-xnf-simulator/pom.xml index 4bfd5ee7..83bd19e4 100644 --- a/hv-collector-xnf-simulator/pom.xml +++ b/hv-collector-xnf-simulator/pom.xml @@ -33,7 +33,7 @@ <parent> <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <relativePath>..</relativePath> </parent> @@ -38,7 +38,7 @@ <groupId>org.onap.dcaegen2.collectors.hv-ves</groupId> <artifactId>ves-hv-collector</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> <name>dcaegen2-collectors-veshv</name> <description>VES HighVolume Collector</description> <packaging>pom</packaging> @@ -60,7 +60,6 @@ </modules> <properties> - <kotlin.version>1.2.70</kotlin.version> <arrow.version>0.7.3</arrow.version> <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version> @@ -90,7 +89,6 @@ <docker-image.registry>${onap.nexus.dockerregistry.daily}</docker-image.registry> <docker-image.namespace>onap</docker-image.namespace> <docker-image.name>${project.groupId}.${project.artifactId}</docker-image.name> - <docker-image.latest>1.0-SNAPSHOT</docker-image.latest> <docker.http_proxy/> </properties> @@ -345,7 +343,7 @@ <dependency> <groupId>${project.groupId}</groupId> <artifactId>hv-collector-analysis</artifactId> - <version>1.0.1-SNAPSHOT</version> + <version>1.0.2-SNAPSHOT</version> </dependency> </dependencies> </plugin> @@ -455,7 +453,7 @@ <tags> <tag>${project.version}-${maven.build.timestamp}Z</tag> <tag>${project.version}</tag> - <tag>${docker-image.latest}</tag> + <tag>latest</tag> </tags> </build> </image> |