diff options
Diffstat (limited to 'k6-tests')
-rw-r--r-- | k6-tests/make-logs.sh | 43 | ||||
-rw-r--r-- | k6-tests/ncmp/common/cmhandle-crud.js | 37 | ||||
-rw-r--r-- | k6-tests/ncmp/common/passthrough-crud.js | 2 | ||||
-rw-r--r-- | k6-tests/ncmp/common/search-base.js | 2 | ||||
-rw-r--r-- | k6-tests/ncmp/common/utils.js | 2 | ||||
-rwxr-xr-x | k6-tests/setup.sh | 10 | ||||
-rwxr-xr-x | k6-tests/teardown.sh | 8 |
7 files changed, 78 insertions, 26 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..57ab2ea17f 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'}; 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" |