aboutsummaryrefslogtreecommitdiffstats
path: root/k6-tests
diff options
context:
space:
mode:
Diffstat (limited to 'k6-tests')
-rw-r--r--k6-tests/make-logs.sh43
-rw-r--r--k6-tests/ncmp/common/cmhandle-crud.js37
-rw-r--r--k6-tests/ncmp/common/passthrough-crud.js2
-rw-r--r--k6-tests/ncmp/common/search-base.js2
-rw-r--r--k6-tests/ncmp/common/utils.js4
-rw-r--r--k6-tests/ncmp/config/endurance.json16
-rw-r--r--k6-tests/ncmp/config/kpi.json32
-rw-r--r--k6-tests/ncmp/ncmp-test-runner.js18
-rw-r--r--k6-tests/ncmp/register-cmhandles-only.js44
-rwxr-xr-xk6-tests/setup.sh10
-rwxr-xr-xk6-tests/teardown.sh8
11 files changed, 128 insertions, 88 deletions
diff --git a/k6-tests/make-logs.sh b/k6-tests/make-logs.sh
new file mode 100644
index 0000000000..60976247e5
--- /dev/null
+++ b/k6-tests/make-logs.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+#
+# Copyright 2025 Nordix Foundation.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+SERVICE_NAME="cps-and-ncmp"
+TIMESTAMP=$(date +"%Y%m%d%H%M%S")
+LOG_DIR="${WORKSPACE:-.}/logs"
+TEMP_DIR="$LOG_DIR/temp_$TIMESTAMP"
+ZIP_FILE="$LOG_DIR/${SERVICE_NAME}_logs_$TIMESTAMP.zip"
+
+mkdir -p "$LOG_DIR"
+mkdir -p "$TEMP_DIR"
+
+# Store logs for cps-and-ncmp containers to temp directory
+CONTAINER_IDS=$(docker ps --filter "name=$SERVICE_NAME" --format "{{.ID}}")
+for CONTAINER_ID in $CONTAINER_IDS; do
+ CONTAINER_NAME=$(docker inspect --format="{{.Name}}" "$CONTAINER_ID" | sed 's/\///g')
+ LOG_FILE="$TEMP_DIR/${CONTAINER_NAME}_logs_$TIMESTAMP.log"
+ docker logs "$CONTAINER_ID" > "$LOG_FILE"
+done
+
+# Zip the logs
+zip -r "$ZIP_FILE" "$TEMP_DIR"
+echo "Logs saved to $ZIP_FILE inside workspace"
+
+# Clean temp files
+rm -r "$TEMP_DIR"
+
+# Delete logs older than 2 weeks
+find "$LOG_DIR" -name "${SERVICE_NAME}_logs_*.zip" -mtime +14 -delete
diff --git a/k6-tests/ncmp/common/cmhandle-crud.js b/k6-tests/ncmp/common/cmhandle-crud.js
index 285028f13c..3b6c3ff7b7 100644
--- a/k6-tests/ncmp/common/cmhandle-crud.js
+++ b/k6-tests/ncmp/common/cmhandle-crud.js
@@ -51,19 +51,30 @@ export function waitForAllCmHandlesToBeReady() {
function createCmHandlePayload(cmHandleIds) {
return {
"dmiPlugin": DMI_PLUGIN_URL,
- "createdCmHandles": cmHandleIds.map((cmHandleId, index) => ({
- "cmHandle": cmHandleId,
- "alternateId": cmHandleId.replace('ch-', 'Subnetwork=Europe,ManagedElement='),
- "moduleSetTag": MODULE_SET_TAGS[index % MODULE_SET_TAGS.length],
- "cmHandleProperties": {
- "id": "123"
- },
- "publicCmHandleProperties": {
- "Color": "yellow",
- "Size": "small",
- "Shape": "cube"
- }
- })),
+ "createdCmHandles": cmHandleIds.map((cmHandleId, index) => {
+ // Ensure unique networkSegment within range 1-10
+ let networkSegmentId = Math.floor(Math.random() * 10) + 1; // Random between 1-10
+ let moduleTag = MODULE_SET_TAGS[index % MODULE_SET_TAGS.length];
+
+ return {
+ "cmHandle": cmHandleId,
+ "alternateId": cmHandleId.replace('ch-', 'Region=NorthAmerica,Segment='),
+ "moduleSetTag": moduleTag,
+ "cmHandleProperties": {
+ "segmentId": index + 1,
+ "networkSegment": `Region=NorthAmerica,Segment=${networkSegmentId}`, // Unique within range 1-10
+ "deviceIdentifier": `Element=RadioBaseStation_5G_${index + 1000}`, // Unique per cmHandle
+ "hardwareVersion": `HW-${moduleTag}`, // Shares uniqueness with moduleSetTag
+ "softwareVersion": `Firmware_${moduleTag}`, // Shares uniqueness with moduleSetTag
+ "syncStatus": "ACTIVE",
+ "nodeCategory": "VirtualNode"
+ },
+ "publicCmHandleProperties": {
+ "systemId": index + 1,
+ "systemName": "ncmp"
+ }
+ };
+ }),
};
}
diff --git a/k6-tests/ncmp/common/passthrough-crud.js b/k6-tests/ncmp/common/passthrough-crud.js
index a3d48fd590..eed1ab5190 100644
--- a/k6-tests/ncmp/common/passthrough-crud.js
+++ b/k6-tests/ncmp/common/passthrough-crud.js
@@ -67,7 +67,7 @@ export function legacyBatchRead(cmHandleIds) {
}
function getRandomCmHandleReference(useAlternateId) {
- const prefix = useAlternateId ? 'Subnetwork=Europe,ManagedElement=' : 'ch-';
+ const prefix = useAlternateId ? 'Region=NorthAmerica,Segment=' : '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 af2caf71ec..af7d153416 100644
--- a/k6-tests/ncmp/common/search-base.js
+++ b/k6-tests/ncmp/common/search-base.js
@@ -51,7 +51,7 @@ const SEARCH_PARAMETERS_PER_SCENARIO = {
"cmHandleQueryParameters": [
{
"conditionName": "hasAllProperties",
- "conditionParameters": [{"Color": "yellow"}]
+ "conditionParameters": [{"systemName": "ncmp"}]
}
]
},
diff --git a/k6-tests/ncmp/common/utils.js b/k6-tests/ncmp/common/utils.js
index ee3e9c7b4b..36ce6b48f3 100644
--- a/k6-tests/ncmp/common/utils.js
+++ b/k6-tests/ncmp/common/utils.js
@@ -27,7 +27,7 @@ export const DMI_PLUGIN_URL = testConfig.hosts.dmiStubUrl;
export const CONTAINER_UP_TIME_IN_SECONDS = testConfig.hosts.containerUpTimeInSeconds;
export const LEGACY_BATCH_TOPIC_NAME = 'legacy_batch_topic';
export const TOTAL_CM_HANDLES = 50000;
-export const REGISTRATION_BATCH_SIZE = 100;
+export const REGISTRATION_BATCH_SIZE = 2000;
export const READ_DATA_FOR_CM_HANDLE_DELAY_MS = 300; // must have same value as in docker-compose.yml
export const WRITE_DATA_FOR_CM_HANDLE_DELAY_MS = 670; // must have same value as in docker-compose.yml
export const CONTENT_TYPE_JSON_PARAM = {'Content-Type': 'application/json'};
@@ -113,9 +113,7 @@ export function makeCustomSummaryReport(testResults, scenarioConfig) {
makeSummaryCsvLine('4c', 'CM-handle search with Property filter', 'milliseconds', 'cm_search_property_duration', 4500, testResults, scenarioConfig),
makeSummaryCsvLine('4d', 'CM-handle search with Cps Path filter', 'milliseconds', 'cm_search_cpspath_duration', 4500, testResults, scenarioConfig),
makeSummaryCsvLine('4e', 'CM-handle search with Trust Level filter', 'milliseconds', 'cm_search_trustlevel_duration', 7000, testResults, scenarioConfig),
- makeSummaryCsvLine('5a', 'NCMP overhead for Synchronous single CM-handle pass-through read', 'milliseconds', 'ncmp_overhead_passthrough_read', 20, testResults, scenarioConfig),
makeSummaryCsvLine('5b', 'NCMP overhead for Synchronous single CM-handle pass-through read with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_read_alt_id', 40, testResults, scenarioConfig),
- makeSummaryCsvLine('6a', 'NCMP overhead for Synchronous single CM-handle pass-through write', 'milliseconds', 'ncmp_overhead_passthrough_write', 20, testResults, scenarioConfig),
makeSummaryCsvLine('6b', 'NCMP overhead for Synchronous single CM-handle pass-through write with alternate id', 'milliseconds', 'ncmp_overhead_passthrough_write_alt_id', 40, testResults, scenarioConfig),
makeSummaryCsvLine('7', 'Legacy batch read operation', 'events/second', 'legacy_batch_read_cmhandles_per_second', 300, testResults, scenarioConfig),
];
diff --git a/k6-tests/ncmp/config/endurance.json b/k6-tests/ncmp/config/endurance.json
index d4893a45cc..8f65b81bb8 100644
--- a/k6-tests/ncmp/config/endurance.json
+++ b/k6-tests/ncmp/config/endurance.json
@@ -6,28 +6,16 @@
"containerUpTimeInSeconds": 420
},
"scenarios": {
- "passthrough_read_scenario": {
- "executor": "constant-vus",
- "exec": "passthroughReadScenario",
- "vus": 2,
- "duration": "2h"
- },
"passthrough_read_alt_id_scenario": {
"executor": "constant-vus",
"exec": "passthroughReadAltIdScenario",
- "vus": 2,
- "duration": "2h"
- },
- "passthrough_write_scenario": {
- "executor": "constant-vus",
- "exec": "passthroughWriteScenario",
- "vus": 2,
+ "vus": 4,
"duration": "2h"
},
"passthrough_write_alt_id_scenario": {
"executor": "constant-vus",
"exec": "passthroughWriteAltIdScenario",
- "vus": 2,
+ "vus": 4,
"duration": "2h"
},
"cm_handle_id_search_nofilter_scenario": {
diff --git a/k6-tests/ncmp/config/kpi.json b/k6-tests/ncmp/config/kpi.json
index b691ed5d7f..aa93091b67 100644
--- a/k6-tests/ncmp/config/kpi.json
+++ b/k6-tests/ncmp/config/kpi.json
@@ -6,44 +6,24 @@
"containerUpTimeInSeconds": 300
},
"scenarios": {
- "passthrough_read_scenario": {
- "executor": "constant-arrival-rate",
- "exec": "passthroughReadScenario",
- "rate": 5,
- "timeUnit": "1s",
- "duration": "15m",
- "preAllocatedVUs": 5,
- "startTime": "0ms"
- },
"passthrough_read_alt_id_scenario": {
"executor": "constant-arrival-rate",
"exec": "passthroughReadAltIdScenario",
- "rate": 5,
+ "rate": 25,
"timeUnit": "1s",
"duration": "15m",
- "preAllocatedVUs": 5,
+ "preAllocatedVUs": 10,
"startTime": "200ms"
},
-
- "passthrough_write_scenario": {
- "executor": "constant-arrival-rate",
- "exec": "passthroughWriteScenario",
- "rate": 5,
- "timeUnit": "1s",
- "duration": "15m",
- "preAllocatedVUs": 5,
- "startTime": "400ms"
- },
"passthrough_write_alt_id_scenario": {
"executor": "constant-arrival-rate",
"exec": "passthroughWriteAltIdScenario",
- "rate": 5,
+ "rate": 13,
"timeUnit": "1s",
"duration": "15m",
- "preAllocatedVUs": 5,
+ "preAllocatedVUs": 10,
"startTime": "600ms"
},
-
"cm_handle_id_search_nofilter_scenario": {
"executor": "constant-arrival-rate",
"exec": "cmHandleIdSearchNoFilterScenario",
@@ -89,7 +69,6 @@
"preAllocatedVUs": 1,
"startTime": "1600ms"
},
-
"cm_handle_search_nofilter_scenario": {
"executor": "constant-arrival-rate",
"exec": "cmHandleSearchNoFilterScenario",
@@ -135,7 +114,6 @@
"preAllocatedVUs": 1,
"startTime": "12s"
},
-
"legacy_batch_produce_scenario": {
"executor": "shared-iterations",
"exec": "legacyBatchProduceScenario",
@@ -163,8 +141,6 @@
"http_req_failed": ["rate == 0"],
"cmhandles_created_per_second": ["avg >= 22"],
"cmhandles_deleted_per_second": ["avg >= 22"],
- "ncmp_overhead_passthrough_read": ["avg <= 40"],
- "ncmp_overhead_passthrough_write": ["avg <= 40"],
"ncmp_overhead_passthrough_read_alt_id": ["avg <= 40"],
"ncmp_overhead_passthrough_write_alt_id": ["avg <= 40"],
"id_search_nofilter_duration": ["avg <= 2000"],
diff --git a/k6-tests/ncmp/ncmp-test-runner.js b/k6-tests/ncmp/ncmp-test-runner.js
index 89d1c0cfe7..b8fccdd69c 100644
--- a/k6-tests/ncmp/ncmp-test-runner.js
+++ b/k6-tests/ncmp/ncmp-test-runner.js
@@ -34,9 +34,7 @@ import { sendKafkaMessages } from './common/produce-avc-event.js';
let cmHandlesCreatedPerSecondTrend = new Trend('cmhandles_created_per_second', false);
let cmHandlesDeletedPerSecondTrend = new Trend('cmhandles_deleted_per_second', false);
-let passthroughReadNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_read', true);
let passthroughReadNcmpOverheadTrendWithAlternateId = new Trend('ncmp_overhead_passthrough_read_alt_id', true);
-let passthroughWriteNcmpOverheadTrend = new Trend('ncmp_overhead_passthrough_write', true);
let passthroughWriteNcmpOverheadTrendWithAlternateId = new Trend('ncmp_overhead_passthrough_write_alt_id', true);
let idSearchNoFilterDurationTrend = new Trend('id_search_nofilter_duration', true);
let idSearchModuleDurationTrend = new Trend('id_search_module_duration', true);
@@ -102,14 +100,6 @@ export function teardown() {
sleep(CONTAINER_UP_TIME_IN_SECONDS);
}
-export function passthroughReadScenario() {
- const response = passthroughRead(false);
- if (check(response, { 'passthrough read status equals 200': (r) => r.status === 200 })) {
- const overhead = response.timings.duration - READ_DATA_FOR_CM_HANDLE_DELAY_MS;
- passthroughReadNcmpOverheadTrend.add(overhead);
- }
-}
-
export function passthroughReadAltIdScenario() {
const response = passthroughRead(true);
if (check(response, { 'passthrough read with alternate Id status equals 200': (r) => r.status === 200 })) {
@@ -118,14 +108,6 @@ export function passthroughReadAltIdScenario() {
}
}
-export function passthroughWriteScenario() {
- const response = passthroughWrite(false);
- if (check(response, { 'passthrough write status equals 201': (r) => r.status === 201 })) {
- const overhead = response.timings.duration - WRITE_DATA_FOR_CM_HANDLE_DELAY_MS;
- passthroughWriteNcmpOverheadTrend.add(overhead);
- }
-}
-
export function passthroughWriteAltIdScenario() {
const response = passthroughWrite(true);
if (check(response, { 'passthrough write with alternate Id status equals 201': (r) => r.status === 201 })) {
diff --git a/k6-tests/ncmp/register-cmhandles-only.js b/k6-tests/ncmp/register-cmhandles-only.js
new file mode 100644
index 0000000000..18c2f85c06
--- /dev/null
+++ b/k6-tests/ncmp/register-cmhandles-only.js
@@ -0,0 +1,44 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright 2025 OpenInfra Foundation Europe. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+/**
+ * To run this script, ensure docker-compose is started, then run this k6 script:
+ * docker-compose -f docker-compose/docker-compose.yml --profile dmi-stub --project-name kpi up --wait
+ * k6 run register-cmhandles-only.js -e TEST_PROFILE=kpi
+ * After, the system will be running with 50,000 CM-handles created.
+ */
+
+import { check } from 'k6';
+import { TOTAL_CM_HANDLES, REGISTRATION_BATCH_SIZE, makeBatchOfCmHandleIds } from './common/utils.js';
+import { createCmHandles, waitForAllCmHandlesToBeReady } from './common/cmhandle-crud.js';
+
+/**
+ * This function registers CM-handles in batches and waits until all are in READY state.
+ * The number of handles to be registered is TOTAL_CM_HANDLES defined in common/utils.js
+ */
+export default function () {
+ const TOTAL_BATCHES = Math.ceil(TOTAL_CM_HANDLES / REGISTRATION_BATCH_SIZE);
+ for (let batchNumber = 0; batchNumber < TOTAL_BATCHES; batchNumber++) {
+ const nextBatchOfCmHandleIds = makeBatchOfCmHandleIds(REGISTRATION_BATCH_SIZE, batchNumber);
+ const response = createCmHandles(nextBatchOfCmHandleIds);
+ check(response, { 'create CM-handles status equals 200': (r) => r.status === 200 });
+ }
+ waitForAllCmHandlesToBeReady();
+}
diff --git a/k6-tests/setup.sh b/k6-tests/setup.sh
index c01a0f6c60..d990475522 100755
--- a/k6-tests/setup.sh
+++ b/k6-tests/setup.sh
@@ -26,11 +26,11 @@ docker-compose \
--profile dmi-stub \
up --quiet-pull --detach --wait || exit 1
- if [[ "$testProfile" == "kpi" ]]; then
- ACTUATOR_PORT=8883
- elif [[ "$testProfile" == "endurance" ]]; then
- ACTUATOR_PORT=8884
- fi
+if [[ "$testProfile" == "kpi" ]]; then
+ ACTUATOR_PORT=8883
+elif [[ "$testProfile" == "endurance" ]]; then
+ ACTUATOR_PORT=8884
+fi
echo "Build information:"
curl --silent --show-error http://localhost:$ACTUATOR_PORT/actuator/info
diff --git a/k6-tests/teardown.sh b/k6-tests/teardown.sh
index 10db7ac7e0..7804a73286 100755
--- a/k6-tests/teardown.sh
+++ b/k6-tests/teardown.sh
@@ -18,11 +18,9 @@
echo '================================== docker info =========================='
docker ps -a
-echo '================================== CPS-NCMP Logs ========================'
-for CONTAINER_ID in $(docker ps --filter "name=cps-and-ncmp" --format "{{.ID}}"); do
- echo "CPS-NCMP Logs for container: $CONTAINER_ID"
- docker logs "$CONTAINER_ID"
-done
+# Zip and store logs for the containers
+chmod +x make-logs.sh
+./make-logs.sh
testProfile=$1
docker_compose_shutdown_cmd="docker-compose -f ../docker-compose/docker-compose.yml --profile dmi-stub --project-name $testProfile down --volumes"