From eb766269ca42c91a985797c15fdaa9de255b904e Mon Sep 17 00:00:00 2001 From: Filip Krzywka Date: Tue, 11 Sep 2018 14:45:53 +0200 Subject: Align with latest HV-VES proto definition - excluded measurements proto files from build to keep them reference-only Change-Id: I8c6de20eeeb1b9f8cd2ae4e865de368afe55cc91 Issue-ID: DCAEGEN2-775 Signed-off-by: Filip Krzywka --- .../dcae/collectors/veshv/tests/utils/messages.kt | 9 ++++-- .../dcae/collectors/veshv/tests/utils/vesEvents.kt | 35 +++++++++++++--------- 2 files changed, 27 insertions(+), 17 deletions(-) (limited to 'hv-collector-test-utils/src') diff --git a/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/messages.kt b/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/messages.kt index c6aa89b2..78042260 100644 --- a/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/messages.kt +++ b/hv-collector-test-utils/src/main/kotlin/org/onap/dcae/collectors/veshv/tests/utils/messages.kt @@ -25,7 +25,10 @@ import io.netty.buffer.ByteBufAllocator import io.netty.buffer.PooledByteBufAllocator import org.onap.dcae.collectors.veshv.domain.PayloadWireFrameMessage.Companion.MAX_PAYLOAD_SIZE import org.onap.dcae.collectors.veshv.domain.PayloadWireFrameMessage.Companion.RESERVED_BYTE_COUNT -import org.onap.ves.VesEventV5.VesEvent.CommonEventHeader.Domain +import org.onap.dcae.collectors.veshv.domain.VesEventDomain +import org.onap.dcae.collectors.veshv.domain.VesEventDomain.HVMEAS +import org.onap.dcae.collectors.veshv.domain.VesEventDomain.OTHER + import java.util.UUID.randomUUID @@ -39,7 +42,7 @@ private fun ByteBuf.writeValidWireFrameHeaders() { writeByte(0x01) // content type = GPB } -fun vesWireFrameMessage(domain: Domain = Domain.OTHER, +fun vesWireFrameMessage(domain: VesEventDomain = OTHER, id: String = randomUUID().toString()): ByteBuf = allocator.buffer().run { writeValidWireFrameHeaders() @@ -70,7 +73,7 @@ fun invalidWireFrame(): ByteBuf = allocator.buffer().run { writeByte(0x01) // content type = GPB } -fun vesMessageWithTooBigPayload(domain: Domain = Domain.DOMAIN_UNDEFINED): ByteBuf = +fun vesMessageWithTooBigPayload(domain: VesEventDomain = HVMEAS): ByteBuf = allocator.buffer().run { writeValidWireFrameHeaders() 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 6aeb6206..0341c2ff 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 @@ -23,27 +23,31 @@ package org.onap.dcae.collectors.veshv.tests.utils import com.google.protobuf.ByteString import com.google.protobuf.MessageLite import org.onap.dcae.collectors.veshv.domain.ByteData -import org.onap.ves.VesEventV5 +import org.onap.dcae.collectors.veshv.domain.VesEventDomain +import org.onap.dcae.collectors.veshv.domain.VesEventDomain.HVMEAS +import org.onap.ves.VesEventOuterClass +import org.onap.ves.VesEventOuterClass.CommonEventHeader +import org.onap.ves.VesEventOuterClass.CommonEventHeader.Priority import java.util.UUID.randomUUID -fun vesEvent(domain: VesEventV5.VesEvent.CommonEventHeader.Domain = VesEventV5.VesEvent.CommonEventHeader.Domain.HVRANMEAS, +fun vesEvent(domain: VesEventDomain = HVMEAS, id: String = randomUUID().toString(), hvRanMeasFields: ByteString = ByteString.EMPTY -): VesEventV5.VesEvent = vesEvent(commonHeader(domain, id), hvRanMeasFields) +): VesEventOuterClass.VesEvent = vesEvent(commonHeader(domain, id), hvRanMeasFields) -fun vesEvent(commonEventHeader: VesEventV5.VesEvent.CommonEventHeader, - hvRanMeasFields: ByteString = ByteString.EMPTY): VesEventV5.VesEvent = - VesEventV5.VesEvent.newBuilder() +fun vesEvent(commonEventHeader: CommonEventHeader, + hvRanMeasFields: ByteString = ByteString.EMPTY): VesEventOuterClass.VesEvent = + VesEventOuterClass.VesEvent.newBuilder() .setCommonEventHeader(commonEventHeader) - .setHvRanMeasFields(hvRanMeasFields) + .setHvMeasFields(hvRanMeasFields) .build() -fun commonHeader(domain: VesEventV5.VesEvent.CommonEventHeader.Domain = VesEventV5.VesEvent.CommonEventHeader.Domain.HVRANMEAS, +fun commonHeader(domain: VesEventDomain = HVMEAS, id: String = randomUUID().toString(), - priority: VesEventV5.VesEvent.CommonEventHeader.Priority = VesEventV5.VesEvent.CommonEventHeader.Priority.NORMAL): VesEventV5.VesEvent.CommonEventHeader = - VesEventV5.VesEvent.CommonEventHeader.newBuilder() + priority: Priority = Priority.NORMAL): CommonEventHeader = + CommonEventHeader.newBuilder() .setVersion("sample-version") - .setDomain(domain) + .setDomain(domain.name) .setSequence(1) .setPriority(priority) .setEventId(id) @@ -53,13 +57,16 @@ fun commonHeader(domain: VesEventV5.VesEvent.CommonEventHeader.Domain = VesEvent .setLastEpochMicrosec(120034455) .setNfNamingCode("sample-nf-naming-code") .setNfcNamingCode("sample-nfc-naming-code") - .setReportingEntityId("sample-reporting-entity-id") - .setReportingEntityName(ByteString.copyFromUtf8("sample-reporting-entity-name")) + .setNfVendorName("vendor-name") + .setReportingEntityId(ByteString.copyFromUtf8("sample-reporting-entity-id")) + .setReportingEntityName("sample-reporting-entity-name") .setSourceId(ByteString.copyFromUtf8("sample-source-id")) .setSourceName("sample-source-name") + .setTimeZoneOffset("+1") + .setVesEventListenerVersion("another-version") .build() -fun vesEventBytes(commonHeader: VesEventV5.VesEvent.CommonEventHeader, byteString: ByteString = ByteString.EMPTY): ByteData = +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 -- cgit 1.2.3-korg