Refactor CM Handle Properties to be more realistic into K6 tests 21/140321/4
authorsourabh_sourabh <sourabh.sourabh@est.tech>
Thu, 27 Feb 2025 16:15:41 +0000 (16:15 +0000)
committersourabh_sourabh <sourabh.sourabh@est.tech>
Fri, 7 Mar 2025 14:32:50 +0000 (14:32 +0000)
Issue-ID: CPS-2637
Change-Id: I627cb8be0738e6b0f82dace361eb02889f193ace
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
k6-tests/ncmp/common/cmhandle-crud.js
k6-tests/ncmp/common/passthrough-crud.js
k6-tests/ncmp/common/search-base.js

index 285028f..3b6c3ff 100644 (file)
@@ -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"
+                }
+            };
+        }),
     };
 }
 
index a3d48fd..eed1ab5 100644 (file)
@@ -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)}`;
 }
 
index af2caf7..af7d153 100644 (file)
@@ -51,7 +51,7 @@ const SEARCH_PARAMETERS_PER_SCENARIO = {
         "cmHandleQueryParameters": [
             {
                 "conditionName": "hasAllProperties",
-                "conditionParameters": [{"Color": "yellow"}]
+                "conditionParameters": [{"systemName": "ncmp"}]
             }
         ]
     },