Merge "K6 performance test for Alternate Id Read"
diff --git a/k6-tests/ncmp/common/cmhandle-crud.js b/k6-tests/ncmp/common/cmhandle-crud.js
index 6d5aff7..6eb1923 100644
--- a/k6-tests/ncmp/common/cmhandle-crud.js
+++ b/k6-tests/ncmp/common/cmhandle-crud.js
@@ -46,6 +46,7 @@
         "dmiPlugin": DMI_PLUGIN_URL,
         "createdCmHandles": cmHandleIds.map(cmHandleId => ({
             "cmHandle": cmHandleId,
+            "alternateId": `alt-${cmHandleId}`,
             "cmHandleProperties": {"neType": "RadioNode"},
             "publicCmHandleProperties": {
                 "Color": "yellow",
diff --git a/k6-tests/ncmp/common/passthrough-crud.js b/k6-tests/ncmp/common/passthrough-crud.js
index 76bda4e..5617f9d 100644
--- a/k6-tests/ncmp/common/passthrough-crud.js
+++ b/k6-tests/ncmp/common/passthrough-crud.js
@@ -36,6 +36,16 @@
     return response;
 }
 
+export function passthroughReadWithAltId() {
+    const cmHandleId = getRandomCmHandleId();
+    const resourceIdentifier = 'my-resource-identifier';
+    const includeDescendants = true;
+    const datastoreName = 'ncmp-datastore:passthrough-operational';
+    const url = `${NCMP_BASE_URL}/ncmp/v1/ch/alt-${cmHandleId}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}&include-descendants=${includeDescendants}`
+    const response = http.get(url);
+    return response;
+}
+
 export function passthroughWrite() {
     const cmHandleId = getRandomCmHandleId();
     const resourceIdentifier = 'my-resource-identifier';
diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js
index f24edc5..b0e39c0 100644
--- a/k6-tests/ncmp/common/utils.js
+++ b/k6-tests/ncmp/common/utils.js
@@ -66,6 +66,7 @@
         makeSummaryCsvLine('4', 'CM-handle search with Module filter', 'milliseconds', 'http_req_duration{scenario:cm_search_module}', data, options),
         makeSummaryCsvLine('5a', 'Synchronous single CM-handle pass-through read', 'requests/second', 'http_reqs{scenario:passthrough_read}', data, options),
         makeSummaryCsvLine('5b', 'NCMP overhead for Synchronous single CM-handle pass-through read', 'milliseconds', 'ncmp_overhead_passthrough_read', data, options),
+        makeSummaryCsvLine('5c', 'NCMP overhead for Synchronous single CM-handle pass-through read with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_read_alt_id', data, options),
         makeSummaryCsvLine('6a', 'Synchronous single CM-handle pass-through write', 'requests/second', 'http_reqs{scenario:passthrough_write}', data, options),
         makeSummaryCsvLine('6b', 'NCMP overhead for Synchronous single CM-handle pass-through write', 'milliseconds', 'ncmp_overhead_passthrough_write', data, options),
         makeSummaryCsvLine('7', 'Data operations batch read', 'events/second', 'data_operations_batch_read_cmhandles_per_second', data, options),
diff --git a/k6-tests/ncmp/ncmp-kpi.js b/k6-tests/ncmp/ncmp-kpi.js
index 8ff9ec5..d7e4405 100644
--- a/k6-tests/ncmp/ncmp-kpi.js
+++ b/k6-tests/ncmp/ncmp-kpi.js
@@ -27,7 +27,7 @@
 } from './common/utils.js';
 import { registerAllCmHandles, deregisterAllCmHandles } from './common/cmhandle-crud.js';
 import { executeCmHandleSearch, executeCmHandleIdSearch } from './common/search-base.js';
-import { passthroughRead, passthroughWrite, batchRead } from './common/passthrough-crud.js';
+import { passthroughRead, passthroughReadWithAltId, passthroughWrite, batchRead } from './common/passthrough-crud.js';
 import {
     Reader,
 } from 'k6/x/kafka';
@@ -35,6 +35,7 @@
 let cmHandlesCreatedPerSecondGauge = new Gauge('cmhandles_created_per_second');
 let cmHandlesDeletedPerSecondGauge = new Gauge('cmhandles_deleted_per_second');
 let passthroughReadNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_read');
+let passthroughReadNcmpOverheadTrendWithAlternateId = new Trend('ncmp_overhead_passthrough_read_alt_id');
 let passthroughWriteNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_write');
 let dataOperationsBatchReadCmHandlePerSecondTrend = new Trend('data_operations_batch_read_cmhandles_per_second');
 
@@ -55,6 +56,12 @@
             vus: 10,
             duration: DURATION,
         },
+        passthrough_read_alt_id: {
+            executor: 'constant-vus',
+            exec: 'passthrough_read_alt_id',
+            vus: 1,
+            duration: DURATION,
+        },
         passthrough_write: {
             executor: 'constant-vus',
             exec: 'passthrough_write',
@@ -96,6 +103,7 @@
         'http_reqs{scenario:passthrough_write}': ['rate >= 13'],
         'http_reqs{scenario:passthrough_read}': ['rate >= 25'],
         'ncmp_overhead_passthrough_read': ['avg <= 100'],
+        'ncmp_overhead_passthrough_read_alt_id': ['avg <= 100'],
         'ncmp_overhead_passthrough_write': ['avg <= 100'],
         'http_req_duration{scenario:id_search_module}': ['avg <= 625'],
         'http_req_duration{scenario:cm_search_module}': ['avg <= 13000'],
@@ -126,6 +134,13 @@
     passthroughReadNcmpOverheadTrend.add(overhead);
 }
 
+export function passthrough_read_alt_id() {
+    const response = passthroughReadWithAltId();
+    check(response, { 'passthrough read with alternate Id status equals 200': (r) => r.status === 200 });
+    const overhead = response.timings.duration - READ_DATA_FOR_CM_HANDLE_DELAY_MS;
+    passthroughReadNcmpOverheadTrendWithAlternateId.add(overhead);
+}
+
 export function passthrough_write() {
     const response = passthroughWrite();
     check(response, { 'passthrough write status equals 201': (r) => r.status === 201 });