Update proto file to v14 23/73123/2
authorJakub Dudycz <jakub.dudycz@nokia.com>
Tue, 20 Nov 2018 10:43:23 +0000 (11:43 +0100)
committerJakub Dudycz <jakub.dudycz@nokia.com>
Tue, 20 Nov 2018 11:15:11 +0000 (12:15 +0100)
- 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

hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/MessageValidatorTest.kt
hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/validation.kt
hv-collector-domain/src/main/proto/event/VesEvent.proto

index 25bd4f6..3090042 100644 (file)
@@ -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()
             }
         }
     }
index e0615bb..1eb6239 100644 (file)
@@ -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()
index dbe0aa3..6d4c230 100644 (file)
@@ -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;