From e774d8e154736681f8bb918b581bcd2d3fd87eb3 Mon Sep 17 00:00:00 2001 From: "denilson.l65" Date: Thu, 28 Oct 2021 05:35:37 +0000 Subject: Add CPS & AAI components in slice-analysis-ms csit Issue-ID: DCAEGEN2-2956 Signed-off-by: denilson.l65 Change-Id: I5b687b7a76a91e96d2934c9c17f8f72d6097485b --- .../testcases/data/expected_ml_payload0.json | 38 ++++++++++ .../testcases/data/expected_payload_pm0.json | 1 + .../testcases/data/ml_response0.json | 18 +++++ .../testcases/data/performance_notification0.json | 84 ++++++++++++++++++++++ .../testcases/slice-analysis-ms-test-cps-aai.robot | 78 ++++++++++++++++++++ 5 files changed, 219 insertions(+) create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload0.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm0.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response0.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification0.json create mode 100644 tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot (limited to 'tests') diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload0.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload0.json new file mode 100644 index 00000000..81f4f309 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_ml_payload0.json @@ -0,0 +1,38 @@ +{ + "name": "3f2f23fa-c567-4dd8-8f15-f95ae3e6fd84", + "serviceInstanceID": "3f2f23fa-c567-4dd8-8f15-f95ae3e6fd84", + "globalSubscriberId": "5GCustomer", + "subscriptionServiceType": "5G", + "networkType": "AN", + "additionalProperties": { + "modifyAction": "reconfigure", + "snssaiList": [ + "001-00110" + ], + "sliceProfileId": "3f2f23fa-c567-4dd8-8f15-f95ae3e6fd83", + "resourceConfig": { + "snssai": "001-00110", + "data": [ + { + "gNBCUName": "cucpserver1", + "nearRTRICId": "11", + "cellCUList": [ + { + "cellLocalId": 11220, + "configData": { + "maxNumberofConns": "20", + "predictedMaxNumberofConns": "25", + "lastUpdatedTS": "yyyy/MM/dd HH:mm:ss" + } + } + ] + } + ] + }, + "nsiInfo": { + "nsiName": "", + "nsiId": "36575a3f-c18c-4bf1-908e-e498ee481853" + }, + "scriptName": "AN" + } +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm0.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm0.json new file mode 100644 index 00000000..f730294d --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/expected_payload_pm0.json @@ -0,0 +1 @@ +{"name":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd84","serviceInstanceID":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd84","globalSubscriberId":"5GCustomer","subscriptionServiceType":"5G","networkType":"AN","additionalProperties":{"modifyAction":"reconfigure","snssaiList":["001-00110"],"sliceProfileId":"3f2f23fa-c567-4dd8-8f15-f95ae3e6fd84","resourceConfig":{"11":{"dLThptPerSlice":40,"uLThptPerSlice":50}},"nsiInfo":{"nsiName":"","nsiId":"7455d0de-fc43-4260-b8d4-5b57d357ea57"},"scriptName":"AN"}} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response0.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response0.json new file mode 100644 index 00000000..476ba86c --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/ml_response0.json @@ -0,0 +1,18 @@ +{ + "snssai": "001-00110", + "data": [ + { + "gNBCUName": "cucpserver1", + "cellCUList": [ + { + "cellLocalId": 11220, + "configData": { + "maxNumberofConns": "20", + "predictedMaxNumberofConns": "25", + "lastUpdatedTS": "yyyy/MM/dd HH:mm:ss" + } + } + ] + } + ] +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification0.json b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification0.json new file mode 100644 index 00000000..f6c649c2 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/data/performance_notification0.json @@ -0,0 +1,84 @@ +{ + "event": { + "commonEventHeader": { + "domain": "perf3gpp", + "eventId": "9e7c7db8-7a51-4bff-94f5-b530296edd7c", + "sequence": 0, + "eventName": "perf3gpp_AcmeNode-Acme_pmMeasResult", + "sourceName": "oteNB5309", + "reportingEntityName": "", + "priority": "Normal", + "startEpochMicrosec": 1538478000000, + "lastEpochMicrosec": 1538478900000, + "version": "4.0", + "vesEventListenerVersion": "7.1", + "timeZoneOffset": "UTC+05:00" + }, + "perf3gppFields": { + "perf3gppFieldsVersion": "1", + "measDataCollection": { + "granularityPeriod": 1538482500000, + "measuredEntityUserName": "", + "measuredEntityDn": "1", + "measuredEntitySoftwareVersion": "r0.1", + "measInfoList": [ + { + "measInfoId": { + "sMeasInfoId": "some measInfoId" + }, + "measTypes": { + "sMeasTypesList": [ + "SM.PrbUsedDl.001-00110", + "SM.PrbUsedUl.001-00110" + ] + }, + "measValuesList": [ + { + "measObjInstId": "11220", + "suspectFlag": "false", + "measResults": [ + { + "p": 1, + "sValue": "75" + }, + { + "p": 2, + "sValue": "84" + } + ] + }, + { + "measObjInstId": "11221", + "suspectFlag": "false", + "measResults": [ + { + "p": 1, + "sValue": "76" + }, + { + "p": 2, + "sValue": "85" + } + ] + }, + { + "measObjInstId": "11222", + "suspectFlag": "false", + "measResults": [ + { + "p": 1, + "sValue": "90" + }, + { + "p": 2, + "sValue": "95" + } + ] + } + ] + } + ] + } + } + } +} diff --git a/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot new file mode 100644 index 00000000..8c4d8e23 --- /dev/null +++ b/tests/dcaegen2-services-slice-analysis-ms/testcases/slice-analysis-ms-test-cps-aai.robot @@ -0,0 +1,78 @@ +*** Settings *** +Library Collections +Library Process +Library RequestsLibrary +Library String +Library OperatingSystem + +Suite Teardown Delete All Sessions + +*** Variables *** +${SLICE_ANALYSIS_MS_BASE_URL} http://${SLICE_ANALYSIS_MS_IP}:8080 +${HEALTHCHECK_ENDPOINT} /healthcheck +${DMAAP_URL} http://${DMAAP_IP}:3904/events +${unauthenticated.DCAE_CL_OUTPUT} /unauthenticated.DCAE_CL_OUTPUT/23/23 +${POST_DMAAP_EVENT_FOR_ML_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.ML_RESPONSE_TOPIC +${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.PERFORMANCE_MEASUREMENTS + + +*** Test Cases *** + +HealthCheck + + Create Session sliceanalysisms ${SLICE_ANALYSIS_MS_BASE_URL} + ${resp}= Get Request sliceanalysisms ${HEALTHCHECK_ENDPOINT} + Should Be Equal As Strings ${resp.status_code} 200 + + +Post ml notification to dmaap + Create Session dmaap ${DMAAP_URL} + ${headers}= Create Dictionary Content-Type application/json + ${data}= Get File ${TEST_ROBOT_DIR}/data/ml_response0.json + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_ML_NOTIF_URL}', data=$data) + Should Be Equal As Strings ${response.status_code} 200 + + +Verify ml notification trigger + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 30 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for slice-analysis-ms to handle trigger... console=${True} + Sleep 5s + END + + ${expected_string}= Get File ${TEST_ROBOT_DIR}/data/expected_ml_payload0.json + ${expected_payload}= Evaluate json.loads("""${expected_string}""") json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload_str}= Set Variable ${actual_data['payload']} + ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json + +Post pm notification-1 to dmaap + ${data}= Get File ${TEST_ROBOT_DIR}/data/performance_notification0.json + FOR ${j} IN RANGE 6 + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data) + Sleep 10s + END + Should Be Equal As Strings ${response.status_code} 200 + + +Verify pm notification-1 trigger + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 20 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for sliceanalysisms to handle trigger... console=${True} + Sleep 30s + END + ${expected_string}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_pm0.json + ${expected_payload}= Evaluate json.loads("""${expected_string}""") json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload_str}= Set Variable ${actual_data['payload']} + ${actual_payload}= Evaluate json.loads("""${actual_payload_str}""") json + set to dictionary ${expected_payload['additionalProperties']['nsiInfo']} nsiId=${actual_payload['additionalProperties']['nsiInfo']['nsiId']} + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() -- cgit 1.2.3-korg