Change domain to lower case 20/69720/2
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>
Wed, 3 Oct 2018 08:33:40 +0000 (10:33 +0200)
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>
Wed, 3 Oct 2018 11:23:36 +0000 (13:23 +0200)
Change-Id: I097def2ba720fafe0a1e1a88e87f8c03663627c9
Issue-ID: DCAEGEN2-847
Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
README.md
hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/RouterTest.kt
hv-collector-core/src/test/kotlin/org/onap/dcae/collectors/veshv/impl/adapters/ConsulConfigurationProviderTest.kt
hv-collector-ct/src/test/kotlin/org/onap/dcae/collectors/veshv/tests/fakes/configuration.kt
hv-collector-domain/src/main/kotlin/org/onap/dcae/collectors/veshv/domain/VesEventDomain.kt
hv-collector-domain/src/main/proto/event/VesEvent.proto
hv-collector-main/src/test/kotlin/org/onap/dcae/collectors/veshv/main/MicrometerMetricsTest.kt
hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/vesEvents.kt
hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/MessageGeneratorImplTest.kt
hv-collector-ves-message-generator/src/test/kotlin/org/onap/dcae/collectors/veshv/ves/message/generator/impl/impl/parameters.kt

index 1706910..549be44 100644 (file)
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ For more details on the rationale, please read a [high-level feature description
 
 VES-HV was designed to allow for extendability - by adding new domain-specific PROTO files.
 
-The PROTO file, which contains the VES CommonHeader, comes with a binary-type Payload parameter, where domain-specific data shall be placed. Domain-specific data are encoded as well with GPB, and they do require a domain-specific PROTO file to decode the data. This domain-specific PROTO needs to be shared with analytics applications - VES-HV is not analyzing domain-specific data. In order to support the RT-PM use-case, VES-HV includes a "PERF3GPP" domain PROTO file, as within this domain, the high volume data is expected to be reported to VES-HV collector.
+The PROTO file, which contains the VES CommonHeader, comes with a binary-type Payload parameter, where domain-specific data shall be placed. Domain-specific data are encoded as well with GPB, and they do require a domain-specific PROTO file to decode the data. This domain-specific PROTO needs to be shared with analytics applications - VES-HV is not analyzing domain-specific data. In order to support the RT-PM use-case, VES-HV includes a "perf3gpp" domain PROTO file, as within this domain, the high volume data is expected to be reported to VES-HV collector.
 Still, there are no limitations to define additional domains, based on existing VES domains (like Fault, Heartbeat) or completely new domains. New domains can be added "when needed".
 
 In case of new domains, it is necessary to extend the Common Header PROTO "Domain" enumeration with new values covering this new domain(s).
index 5195948..e8a3123 100644 (file)
@@ -45,13 +45,13 @@ object RouterTest : Spek({
         val config = routing {
 
             defineRoute {
-                fromDomain(PERF3GPP.name)
+                fromDomain(PERF3GPP.domainName)
                 toTopic("ves_rtpm")
                 withFixedPartitioning(2)
             }
 
             defineRoute {
-                fromDomain(SYSLOG.name)
+                fromDomain(SYSLOG.domainName)
                 toTopic("ves_trace")
                 withFixedPartitioning()
             }
index f21a2ec..9a6889c 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.dcae.collectors.veshv.impl.adapters
 import com.nhaarman.mockito_kotlin.eq
 import com.nhaarman.mockito_kotlin.mock
 import com.nhaarman.mockito_kotlin.whenever
+import org.assertj.core.api.Assertions.assertThat
 import org.jetbrains.spek.api.Spek
 import org.jetbrains.spek.api.dsl.describe
 import org.jetbrains.spek.api.dsl.given
@@ -67,12 +68,20 @@ internal object ConsulConfigurationProviderTest : Spek({
                                 assertEquals("$kafkaAddress:9093", it.kafkaBootstrapServers)
 
                                 val route1 = it.routing.routes[0]
-                                assertEquals(FAULT.name, route1.domain)
-                                assertEquals("test-topic-1", route1.targetTopic)
+                                assertThat(FAULT.domainName)
+                                        .describedAs("routed domain 1")
+                                        .isEqualTo(route1.domain)
+                                assertThat("test-topic-1")
+                                        .describedAs("target topic 1")
+                                        .isEqualTo(route1.targetTopic)
 
                                 val route2 = it.routing.routes[1]
-                                assertEquals(HEARTBEAT.name, route2.domain)
-                                assertEquals("test-topic-2", route2.targetTopic)
+                                assertThat(HEARTBEAT.domainName)
+                                        .describedAs("routed domain 2")
+                                        .isEqualTo(route2.domain)
+                                assertThat("test-topic-2")
+                                        .describedAs("target topic 2")
+                                        .isEqualTo(route2.targetTopic)
 
                             }.verifyComplete()
                 }
@@ -138,11 +147,11 @@ fun constructConsulResponse(): String {
     "dmaap.kafkaBootstrapServers": "$kafkaAddress:9093",
     "collector.routing": [
             {
-                "fromDomain": "FAULT",
+                "fromDomain": "fault",
                 "toTopic": "test-topic-1"
             },
             {
-                "fromDomain": "HEARTBEAT",
+                "fromDomain": "heartbeat",
                 "toTopic": "test-topic-2"
             }
     ]
index 432b697..3770913 100644 (file)
@@ -39,7 +39,7 @@ val basicConfiguration: CollectorConfiguration = CollectorConfiguration(
         kafkaBootstrapServers = "localhost:9969",
         routing = routing {
             defineRoute {
-                fromDomain(PERF3GPP.name)
+                fromDomain(PERF3GPP.domainName)
                 toTopic(PERF3GPP_TOPIC)
                 withFixedPartitioning()
             }
@@ -50,17 +50,17 @@ val twoDomainsToOneTopicConfiguration: CollectorConfiguration = CollectorConfigu
         kafkaBootstrapServers = "localhost:9969",
         routing = routing {
             defineRoute {
-                fromDomain(PERF3GPP.name)
+                fromDomain(PERF3GPP.domainName)
                 toTopic(PERF3GPP_TOPIC)
                 withFixedPartitioning()
             }
             defineRoute {
-                fromDomain(HEARTBEAT.name)
+                fromDomain(HEARTBEAT.domainName)
                 toTopic(PERF3GPP_TOPIC)
                 withFixedPartitioning()
             }
             defineRoute {
-                fromDomain(MEASUREMENT.name)
+                fromDomain(MEASUREMENT.domainName)
                 toTopic(MEASUREMENTS_FOR_VF_SCALING_TOPIC)
                 withFixedPartitioning()
             }
@@ -72,7 +72,7 @@ val configurationWithDifferentRouting: CollectorConfiguration = CollectorConfigu
         kafkaBootstrapServers = "localhost:9969",
         routing = routing {
             defineRoute {
-                fromDomain(PERF3GPP.name)
+                fromDomain(PERF3GPP.domainName)
                 toTopic(ALTERNATE_PERF3GPP_TOPIC)
                 withFixedPartitioning()
             }
index 322260c..0b18337 100644 (file)
  */
 package org.onap.dcae.collectors.veshv.domain
 
-enum class VesEventDomain {
-    FAULT,
-    HEARTBEAT,
-    MEASUREMENT,
-    MOBILE_FLOW,
-    OTHER,
-    PNFREGISTRATION,
-    SIP_SIGNALING,
-    STATE_CHANGE,
-    SYSLOG,
-    THRESHOLD_CROSSING_ALERT,
-    VOICE_QUALITY,
-    PERF3GPP
+enum class VesEventDomain(val domainName: String) {
+    FAULT("fault"),
+    HEARTBEAT("heartbeat"),
+    MEASUREMENT("measurement"),
+    MOBILE_FLOW("mobileFlow"),
+    OTHER("other"),
+    PNF_REGISTRATION("pnfRegistration"),
+    SIP_SIGNALING("sipSignaling"),
+    STATE_CHANGE("stateChange"),
+    SYSLOG("syslog"),
+    THRESHOLD_CROSSING_ALERT("thresholdCrossingAlert"),
+    VOICE_QUALITY("voiceQuality"),
+    PERF3GPP("perf3gpp");
 }
index f782242..dcd5464 100644 (file)
@@ -28,7 +28,7 @@ message VesEvent                            // top-level message
         // 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
+        // e.g. for domain==perf3gpp, the GPB message is Perf3GPPFields
 }
 
 // VES CommonEventHeader adapted to GPB (Google Protocol Buffers)
@@ -38,8 +38,8 @@ message CommonEventHeader
 {
     string version = 1;                     // required, "version of the gpb common event header"
     string domain = 2;                      // required, "the eventing domain associated with the event", allowed values:
-                                            // FAULT, HEARTBEAT, MEASUREMENT, MOBILE_FLOW, OTHER, PNFREGISTRATION, SIP_SIGNALING,
-                                            // STATE_CHANGE, SYSLOG, THRESHOLD_CROSSING_ALERT, VOICE_QUALITY, PERF3GPP
+                                            // fault, heartbeat, measurement, mobile_flow, other, pnfregistration, sip_signaling,
+                                            // state_change, syslog, threshold_crossing_alert, voice_quality, perf3gpp
 
     uint32 sequence = 3;                    // required, "ordering of events communicated by an event source instance or 0 if not needed"
 
index 3fdb0b5..a379933 100644 (file)
@@ -163,7 +163,7 @@ object MicrometerMetricsTest : Spek({
                 cut.notifyMessageReceived(128)
                 cut.notifyMessageReceived(256)
                 cut.notifyMessageReceived(256)
-                cut.notifyMessageSent("PERF3GPP")
+                cut.notifyMessageSent("perf3gpp")
                 verifyGauge("messages.processing.count") { gauge ->
                     assertThat(gauge.value()).isCloseTo(2.0, doublePrecision)
                 }
@@ -171,7 +171,7 @@ object MicrometerMetricsTest : Spek({
 
             on("zero difference") {
                 cut.notifyMessageReceived(128)
-                cut.notifyMessageSent("PERF3GPP")
+                cut.notifyMessageSent("perf3gpp")
                 verifyGauge("messages.processing.count") { gauge ->
                     assertThat(gauge.value()).isCloseTo(0.0, doublePrecision)
                 }
@@ -179,8 +179,8 @@ object MicrometerMetricsTest : Spek({
 
             on("negative difference") {
                 cut.notifyMessageReceived(128)
-                cut.notifyMessageSent("FAULT")
-                cut.notifyMessageSent("PERF3GPP")
+                cut.notifyMessageSent("fault")
+                cut.notifyMessageSent("perf3gpp")
                 verifyGauge("messages.processing.count") { gauge ->
                     assertThat(gauge.value()).isCloseTo(0.0, doublePrecision)
                 }
index 0cbd650..20d0c50 100644 (file)
@@ -47,7 +47,7 @@ fun commonHeader(domain: VesEventDomain = PERF3GPP,
                  priority: Priority = Priority.NORMAL): CommonEventHeader =
         CommonEventHeader.newBuilder()
                 .setVersion("sample-version")
-                .setDomain(domain.name)
+                .setDomain(domain.domainName)
                 .setSequence(1)
                 .setPriority(priority)
                 .setEventId(id)
index dedf5cc..ec09ac9 100644 (file)
@@ -88,7 +88,7 @@ object MessageGeneratorImplTest : Spek({
                             .assertNext {
                                 assertThat(it.isValid()).isTrue()
                                 assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE)
-                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT.name)
+                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT.domainName)
                             }
                             .verifyComplete()
                 }
@@ -106,7 +106,7 @@ object MessageGeneratorImplTest : Spek({
                             .assertNext {
                                 assertThat(it.isValid()).isTrue()
                                 assertThat(it.payloadSize).isGreaterThan(WireFrameMessage.MAX_PAYLOAD_SIZE)
-                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.name)
+                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.domainName)
                             }
                             .verifyComplete()
                 }
@@ -141,7 +141,7 @@ object MessageGeneratorImplTest : Spek({
                             .assertNext {
                                 assertThat(it.isValid()).isFalse()
                                 assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE)
-                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.name)
+                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.domainName)
                                 assertThat(it.versionMajor).isNotEqualTo(WireFrameMessage.SUPPORTED_VERSION_MINOR)
                             }
                             .verifyComplete()
@@ -160,7 +160,7 @@ object MessageGeneratorImplTest : Spek({
                                 assertThat(it.isValid()).isTrue()
                                 assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE)
                                 assertThat(extractEventFields(it.payload).size()).isEqualTo(MessageGenerator.FIXED_PAYLOAD_SIZE)
-                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT.name)
+                                assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT.domainName)
                             }
                             .verifyComplete()
                 }
@@ -178,17 +178,17 @@ object MessageGeneratorImplTest : Spek({
                         .test()
                         .assertNext {
                             assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE)
-                            assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.name)
+                            assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(PERF3GPP.domainName)
                         }
                         .expectNextCount(singleFluxSize - 1)
                         .assertNext {
                             assertThat(it.payloadSize).isGreaterThan(WireFrameMessage.MAX_PAYLOAD_SIZE)
-                            assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT.name)
+                            assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(FAULT.domainName)
                         }
                         .expectNextCount(singleFluxSize - 1)
                         .assertNext {
                             assertThat(it.payloadSize).isLessThan(WireFrameMessage.MAX_PAYLOAD_SIZE)
-                            assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(HEARTBEAT.name)
+                            assertThat(extractCommonEventHeader(it.payload).domain).isEqualTo(HEARTBEAT.domainName)
                         }
                         .expectNextCount(singleFluxSize - 1)
                         .verifyComplete()
index 00c08aa..dd8bc89 100644 (file)
@@ -26,7 +26,7 @@ private const val validMessageParameters =
         {
           "commonEventHeader": {
             "version": "sample-version",
-            "domain": "PERF3GPP",
+            "domain": "perf3gpp",
             "sequence": 1,
             "priority": 1,
             "eventId": "sample-event-id",
@@ -48,7 +48,7 @@ private const val validMessageParameters =
         {
           "commonEventHeader": {
             "version": "sample-version",
-            "domain": "PERF3GPP",
+            "domain": "perf3gpp",
             "sequence": 1,
             "priority": 1,
             "eventId": "sample-event-id",
@@ -76,7 +76,7 @@ private const val invalidMessageParameters =
         {
           "commonEventHeader": {
             "version": "sample-version",
-            "domain": "PERF3GPP",
+            "domain": "perf3gpp",
             "sequence": 1,
             "priority": 1,
             "eventId": "sample-event-id",