diff options
author | mpriyank <priyank.maheshwari@est.tech> | 2024-11-04 15:59:58 +0000 |
---|---|---|
committer | mpriyank <priyank.maheshwari@est.tech> | 2024-11-04 16:03:39 +0000 |
commit | 2dd658268202f92e0b5621093747f13670e5d042 (patch) | |
tree | 49e2847ebeed496d9d6ca06437f0e8a055a96a50 /k6-tests | |
parent | 408e84480e96e8bc4119bd2864ab05fd13832214 (diff) |
Cm Avc Event to have same key
- incoming Cm Avc Event from DMI Plugin is consumed and forwarded to
target topic
- the key from source topic to be used in the target topic while
forwarding
- with same key the ordering of the message will be preserved
- NOTE: the RTD related changes will be a separate patchset
Issue-ID: CPS-2436
Change-Id: Ie692663706b378022ec0d621d92ca5054bad8d1b
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'k6-tests')
-rw-r--r-- | k6-tests/once-off-test/kafka/produce-avc-event.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/k6-tests/once-off-test/kafka/produce-avc-event.js b/k6-tests/once-off-test/kafka/produce-avc-event.js index 981a21af65..db222f6a4a 100644 --- a/k6-tests/once-off-test/kafka/produce-avc-event.js +++ b/k6-tests/once-off-test/kafka/produce-avc-event.js @@ -50,6 +50,11 @@ export const options = { } }; +const getRandomNetworkElement = () => { + const networkElementIds = Array.from({ length: 10 }, (_, i) => `neType-${i + 1}`); + return networkElementIds[Math.floor(Math.random() * networkElementIds.length)]; +}; + function getCloudEventHeaders() { return { ce_type: 'org.onap.cps.ncmp.events.avc1_0_0.AvcEvent', @@ -65,10 +70,11 @@ function getCloudEventHeaders() { export function sendKafkaMessages() { const cloudEventHeaders = getCloudEventHeaders(); + const networkElementId = getRandomNetworkElement(); const avcCloudEvent = { key: schemaRegistry.serialize({ - data: cloudEventHeaders.ce_correlationid, + data: networkElementId, schemaType: SCHEMA_TYPE_STRING, }), value: schemaRegistry.serialize({ |