diff options
author | Jakub Dudycz <jakub.dudycz@nokia.com> | 2018-11-20 11:43:23 +0100 |
---|---|---|
committer | Jakub Dudycz <jakub.dudycz@nokia.com> | 2018-11-20 12:15:11 +0100 |
commit | 7d802e8716b08f84839307bf6a184d4c145800ca (patch) | |
tree | 1e6c4fb2bff8436618e9a0344d0bf850b26a57ec | |
parent | e3e2a55c10f00c26a565cdf30a5ae2b49604344d (diff) |
Update proto file to v14
- update proto file
- update vesEventListenerVersion validation regex
to match new requirements
Change-Id: Ic0bd855fd03caa3ca3120b2c49d5fa4f53de2540
Signed-off-by: Jakub Dudycz <jakub.dudycz@nokia.com>
Issue-ID: DCAEGEN2-984
3 files changed, 29 insertions, 15 deletions
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 25bd4f67..3090042d 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 @@ -94,19 +94,34 @@ internal object MessageValidatorTest : Spek({ } } - on("ves hv message including header with vesEventListenerVersion field not matching required pattern") { - val commonHeader = commonHeader(vesEventListenerVersion = "1.2.3") - val commonHeader2 = commonHeader(vesEventListenerVersion = "sample-version") + 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) - val rawMessageBytes2 = vesEventBytes(commonHeader2) 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) - val vesMessage2 = VesMessage(commonHeader2, rawMessageBytes2) - assertThat(cut.isValid(vesMessage2)).describedAs("second message validation result").isFalse() + 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-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 e0615bbe..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 @@ -35,4 +35,4 @@ val headerRequiredFieldDescriptors = listOf( "vesEventListenerVersion") .map { fieldName -> VesEventOuterClass.CommonEventHeader.getDescriptor().findFieldByName(fieldName) } -val vesEventListenerVersionRegex = """7\.[0-9]+\.[0-9]+""".toRegex() +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; |