summaryrefslogtreecommitdiffstats
path: root/k6-tests/ncmp/common
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2024-08-25 21:35:19 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2024-09-04 15:56:55 +0100
commitf2e1e2571fec6fd701df3033641a3e11a8aae62f (patch)
treeef7991afb14259b5d14fd1338d0c02897868a29b /k6-tests/ncmp/common
parentdbf8b078373b9e92f19b3522a8d43e33cea91317 (diff)
[k6] Align tests with updated requirements
- Test load increased to 5 CM handle searches and 5 Id searches to reflect current requirements. - CM handles searches now use a combined search filter including 1 module and 1 public property, so we are testing with a heavier load than required, for early warning of trouble. - Test load reduced for passthrough operations to 4 VUs per operation to reflect addition of batch operation. - Added test of passthrough write operation with alternate ID. - Additional refactoring. Issue-ID: CPS-2349 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I88d2fe431f74821e8e0e976441efcf82aa320849
Diffstat (limited to 'k6-tests/ncmp/common')
-rw-r--r--k6-tests/ncmp/common/cmhandle-crud.js4
-rw-r--r--k6-tests/ncmp/common/passthrough-crud.js37
-rw-r--r--k6-tests/ncmp/common/search-base.js20
-rw-r--r--k6-tests/ncmp/common/utils.js14
4 files changed, 31 insertions, 44 deletions
diff --git a/k6-tests/ncmp/common/cmhandle-crud.js b/k6-tests/ncmp/common/cmhandle-crud.js
index 8f53c9b9be..aa3beb3091 100644
--- a/k6-tests/ncmp/common/cmhandle-crud.js
+++ b/k6-tests/ncmp/common/cmhandle-crud.js
@@ -32,7 +32,7 @@ export function createCmHandles(cmHandleIds) {
"dmiPlugin": DMI_PLUGIN_URL,
"createdCmHandles": cmHandleIds.map((cmHandleId, index) => ({
"cmHandle": cmHandleId,
- "alternateId": `alt-${cmHandleId}`,
+ "alternateId": cmHandleId.replace('ch-', 'alt-'),
"moduleSetTag": MODULE_SET_TAGS[index % MODULE_SET_TAGS.length],
"cmHandleProperties": {"neType": "RadioNode"},
"publicCmHandleProperties": {
@@ -70,4 +70,4 @@ function getNumberOfReadyCmHandles() {
const response = executeCmHandleIdSearch('readyCmHandles');
const arrayOfCmHandleIds = JSON.parse(response.body);
return arrayOfCmHandleIds.length;
-} \ No newline at end of file
+}
diff --git a/k6-tests/ncmp/common/passthrough-crud.js b/k6-tests/ncmp/common/passthrough-crud.js
index 5617f9d093..c5f2dddcf1 100644
--- a/k6-tests/ncmp/common/passthrough-crud.js
+++ b/k6-tests/ncmp/common/passthrough-crud.js
@@ -19,38 +19,24 @@
*/
import http from 'k6/http';
-import {
- CONTENT_TYPE_JSON_PARAM,
- getRandomCmHandleId,
- NCMP_BASE_URL,
- TOPIC_DATA_OPERATIONS_BATCH_READ
-} from './utils.js';
+import { randomIntBetween } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js';
+import { TOTAL_CM_HANDLES, CONTENT_TYPE_JSON_PARAM, NCMP_BASE_URL, TOPIC_DATA_OPERATIONS_BATCH_READ } from './utils.js';
-export function passthroughRead() {
- const cmHandleId = getRandomCmHandleId();
+export function passthroughRead(useAlternateId) {
+ const cmHandleReference = getRandomCmHandleReference(useAlternateId);
const resourceIdentifier = 'my-resource-identifier';
const includeDescendants = true;
const datastoreName = 'ncmp-datastore:passthrough-operational';
- const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleId}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}&include-descendants=${includeDescendants}`
+ const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleReference}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}&include-descendants=${includeDescendants}`
const response = http.get(url);
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();
+export function passthroughWrite(useAlternateId) {
+ const cmHandleReference = getRandomCmHandleReference(useAlternateId);
const resourceIdentifier = 'my-resource-identifier';
const datastoreName = 'ncmp-datastore:passthrough-running';
- const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleId}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}`
+ const url = `${NCMP_BASE_URL}/ncmp/v1/ch/${cmHandleReference}/data/ds/${datastoreName}?resourceIdentifier=${resourceIdentifier}`
const body = `{"neType": "BaseStation"}`
const response = http.post(url, JSON.stringify(body), CONTENT_TYPE_JSON_PARAM);
return response;
@@ -72,4 +58,9 @@ export function batchRead(cmHandleIds) {
};
const response = http.post(url, JSON.stringify(payload), CONTENT_TYPE_JSON_PARAM);
return response;
-} \ No newline at end of file
+}
+
+function getRandomCmHandleReference(useAlternateId) {
+ const prefix = useAlternateId ? 'alt' : 'ch';
+ return `${prefix}-${randomIntBetween(1, TOTAL_CM_HANDLES)}`;
+}
diff --git a/k6-tests/ncmp/common/search-base.js b/k6-tests/ncmp/common/search-base.js
index a7d0c925c4..beb3aad07c 100644
--- a/k6-tests/ncmp/common/search-base.js
+++ b/k6-tests/ncmp/common/search-base.js
@@ -22,19 +22,23 @@ import http from 'k6/http';
import { NCMP_BASE_URL, CONTENT_TYPE_JSON_PARAM } from './utils.js';
const SEARCH_PARAMETERS_PER_SCENARIO = {
- 'module': {
- 'cmHandleQueryParameters': [
+ "module-and-properties": {
+ "cmHandleQueryParameters": [
{
- 'conditionName': 'hasAllModules',
- 'conditionParameters': [{'moduleName': 'ietf-yang-types'}]
+ "conditionName": "hasAllModules",
+ "conditionParameters": [{"moduleName": "ietf-yang-types"}]
+ },
+ {
+ "conditionName": "hasAllProperties",
+ "conditionParameters": [{"Color": "yellow"}]
}
]
},
- 'readyCmHandles': {
- 'cmHandleQueryParameters': [
+ "readyCmHandles": {
+ "cmHandleQueryParameters": [
{
- 'conditionName': 'cmHandleWithCpsPath',
- 'conditionParameters': [{'cpsPath': '//state[@cm-handle-state="READY"]'}]
+ "conditionName": "cmHandleWithCpsPath",
+ "conditionParameters": [{"cpsPath": "//state[@cm-handle-state='READY']"}]
}
]
}
diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js
index 98c9eb86f1..d216f7fe19 100644
--- a/k6-tests/ncmp/common/utils.js
+++ b/k6-tests/ncmp/common/utils.js
@@ -38,17 +38,8 @@ export const MODULE_SET_TAGS = ['tagA','tagB','tagC',' tagD']
* @returns {string[]} Array of CM-handle IDs, for example ['ch-201', 'ch-202' ... 'ch-300']
*/
export function makeBatchOfCmHandleIds(batchSize, batchNumber) {
- const batchOfIds = [];
const startIndex = 1 + batchNumber * batchSize;
- for (let i = 0; i < batchSize; i++) {
- let cmHandleId = `ch-${startIndex + i}`;
- batchOfIds.push(cmHandleId);
- }
- return batchOfIds;
-}
-
-export function getRandomCmHandleId() {
- return `ch-${Math.floor(Math.random() * TOTAL_CM_HANDLES) + 1}`;
+ return Array.from({ length: batchSize }, (_, i) => `ch-${startIndex + i}`);
}
export function makeCustomSummaryReport(data, options) {
@@ -61,7 +52,8 @@ export function makeCustomSummaryReport(data, options) {
makeSummaryCsvLine('4', 'CM-handle search with Module filter', 'milliseconds', 'cm_search_duration', data, options),
makeSummaryCsvLine('5a', 'NCMP overhead for Synchronous single CM-handle pass-through read', 'milliseconds', 'ncmp_overhead_passthrough_read', data, options),
makeSummaryCsvLine('5b', 'NCMP overhead for Synchronous single CM-handle pass-through read with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_read_alt_id', data, options),
- makeSummaryCsvLine('6', 'NCMP overhead for Synchronous single CM-handle pass-through write', 'milliseconds', 'ncmp_overhead_passthrough_write', data, options),
+ makeSummaryCsvLine('6a', 'NCMP overhead for Synchronous single CM-handle pass-through write', 'milliseconds', 'ncmp_overhead_passthrough_write', data, options),
+ makeSummaryCsvLine('6b', 'NCMP overhead for Synchronous single CM-handle pass-through write with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_write_alt_id', data, options),
makeSummaryCsvLine('7', 'Data operations batch read', 'events/second', 'data_operations_batch_read_cmhandles_per_second', data, options),
];
return summaryCsvLines.join('\n') + '\n';