From ea92dc3d81885b320906bc32b989ee4aea011a8c Mon Sep 17 00:00:00 2001 From: Malarvizhi Date: Wed, 23 Mar 2022 14:52:42 +0000 Subject: [DCAEGEN2] Update son-handler CSIT with CPS Issue-ID: DCAEGEN2-3123 Signed-off-by: Malarvizhi Paramasivam Change-Id: I3d332835b061246011234ff84834d6bc2ae74b2b --- .../testcases/data/cps_expected_payload_fm.json | 2 + .../testcases/data/cps_expected_payload_pm.json | 1 + .../testcases/data/cps_fault_notification.json | 35 +++++++ .../testcases/data/fault_notification.json | 7 +- .../testcases/data/performance_notification.json | 4 +- .../testcases/son-handler-test-cps.robot | 102 +++++++++++++++++++++ .../testcases/sonhandler-test.robot | 2 +- 7 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_fm.json create mode 100644 tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_pm.json create mode 100644 tests/dcaegen2-services-son-handler/testcases/data/cps_fault_notification.json create mode 100644 tests/dcaegen2-services-son-handler/testcases/son-handler-test-cps.robot (limited to 'tests') diff --git a/tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_fm.json b/tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_fm.json new file mode 100644 index 00000000..e8d7e518 --- /dev/null +++ b/tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_fm.json @@ -0,0 +1,2 @@ + +{"Configurations":[{"data":{"FAPService":{"alias":"15176","X0005b9Lte":{"phyCellIdInUse":3,"pnfName":"220"},"CellConfig":{"LTE":{"RAN":{"Common":{"CellIdentity":"15176"}}}}}}},{"data":{"FAPService":{"alias":"15174","X0005b9Lte":{"phyCellIdInUse":1,"pnfName":"220"},"CellConfig":{"LTE":{"RAN":{"Common":{"CellIdentity":"15174"}}}}}}}]} diff --git a/tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_pm.json b/tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_pm.json new file mode 100644 index 00000000..2a56f2cc --- /dev/null +++ b/tests/dcaegen2-services-son-handler/testcases/data/cps_expected_payload_pm.json @@ -0,0 +1 @@ +{"Configurations":[{"data":{"FAPService":{"alias":"Chn0002","CellConfig":{"LTE":{"RAN":{"Common":{"CellIdentity":"Chn0002"},"NeighborListInUse":{"LTECell":[{"PNFName":"ncserver1","PLMNID":"plmnid1","CID":"Chn0004","PhyCellID":0,"Blacklisted":"true"},{"PNFName":"ncserver1","CID":"Chn0001","PhyCellID":0,"Blacklisted":"true"}],"LTECellNumberOfEntries":"2"}}}}}}}]} diff --git a/tests/dcaegen2-services-son-handler/testcases/data/cps_fault_notification.json b/tests/dcaegen2-services-son-handler/testcases/data/cps_fault_notification.json new file mode 100644 index 00000000..6b09e5ee --- /dev/null +++ b/tests/dcaegen2-services-son-handler/testcases/data/cps_fault_notification.json @@ -0,0 +1,35 @@ +{ + "event":{ + "commonEventHeader":{ + "domain":"fault", + "eventId":"fault000002", + "eventName":"Fault_RansimAgent-Wipro_RanPCIProblem", + "lastEpochMicrosec":1.633608637561E15, + "priority":"High", + "reportingEntityName":"ncserver1", + "sequence":1, + "sourceName":"15289", + "startEpochMicrosec":1.633608637561E15, + "version":"4.0.1", + "nfNamingCode":"RansimAgent", + "reportingEntityId":"69fb75e9-b85e-4132-ac21-515e9e8f5edb", + "sourceId":"94c26740-c875-4122-9e81-82723769bb54", + "nfVendorName":"Wipro", + "vesEventListenerVersion":"7.2", + "timeZoneOffset":"UTC+05:30" + }, + "faultFields":{ + "alarmCondition":"RanPciCollisionConfusionOccurred", + "eventSeverity":"CRITICAL", + "eventCategory": "PCIConfusion", + "eventSourceType":"other", + "faultFieldsVersion":"4.0", + "specificProblem":"15290", + "vfStatus":"Active", + "alarmAdditionalInformation":{ + "networkId":"10000000" + } + } + } +} + diff --git a/tests/dcaegen2-services-son-handler/testcases/data/fault_notification.json b/tests/dcaegen2-services-son-handler/testcases/data/fault_notification.json index e5a327ad..3d2b2c6e 100644 --- a/tests/dcaegen2-services-son-handler/testcases/data/fault_notification.json +++ b/tests/dcaegen2-services-son-handler/testcases/data/fault_notification.json @@ -2,7 +2,7 @@ "event": { "commonEventHeader": { "version": "4.0.1", - "vesEventListenerVersion": "7.0.1", + "vesEventListenerVersion": "7.2", "domain": "fault", "eventName": "Fault_RansimAgent-Wipro_RanPCIProblem", "eventId": "fault000001", @@ -22,7 +22,8 @@ "faultFieldsVersion": "4.0", "alarmCondition": "RanPciCollisionConfusionOccurred", "eventSourceType": "other", - "specificProblem": "Collision", + "eventCategory": "PCIConfusion", + "specificProblem": "Chn0001", "eventSeverity": "CRITICAL", "vfStatus": "Active", "alarmAdditionalInformation": { @@ -32,4 +33,4 @@ } } } -} \ No newline at end of file +} diff --git a/tests/dcaegen2-services-son-handler/testcases/data/performance_notification.json b/tests/dcaegen2-services-son-handler/testcases/data/performance_notification.json index 7721163a..87d89067 100644 --- a/tests/dcaegen2-services-son-handler/testcases/data/performance_notification.json +++ b/tests/dcaegen2-services-son-handler/testcases/data/performance_notification.json @@ -15,7 +15,7 @@ "lastEpochMicrosec": 1551790542000000, "nfNamingCode": "RansimAgent", "nfVendorName": "Wipro", - "vesEventListenerVersion": "7.0.1", + "vesEventListenerVersion": "7.2", "timeZoneOffset": "UTC-05:30" }, "measurementFields": { @@ -39,4 +39,4 @@ ] } } -} \ No newline at end of file +} diff --git a/tests/dcaegen2-services-son-handler/testcases/son-handler-test-cps.robot b/tests/dcaegen2-services-son-handler/testcases/son-handler-test-cps.robot new file mode 100644 index 00000000..63f23f2d --- /dev/null +++ b/tests/dcaegen2-services-son-handler/testcases/son-handler-test-cps.robot @@ -0,0 +1,102 @@ +*** Settings *** +Library Collections +Library Process +Library RequestsLibrary +Library String +Library OperatingSystem + +Suite Teardown Delete All Sessions + +*** Variables *** +${SON_HANDLER_BASE_URL} http://${SONHMS_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_FM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.SEC_FAULT_OUTPUT +${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL} http://${DMAAP_IP}:3904/events/unauthenticated.VES_MEASUREMENT_OUTPUT +${POST_DMAAP_EVENT_FOR_POLICY_RESPONSE} http://${DMAAP_IP}:3904/events/DCAE_CL_RSP + + +*** Test Cases *** + +HealthCheck + + Create Session sonhms ${SON_HANDLER_BASE_URL} + ${resp}= Get Request sonhms ${HEALTHCHECK_ENDPOINT} + Should Be Equal As Strings ${resp.status_code} 200 + + +Post fm notification to dmaap + Create Session dmaap ${DMAAP_URL} + ${headers}= Create Dictionary Content-Type application/json + ${data}= Get File ${TEST_ROBOT_DIR}/data/cps_fault_notification.json + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_FM_NOTIF_URL}', data=$data) + Should Be Equal As Strings ${response.status_code} 200 + + +Verify fm notification trigger in sonhms + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 10 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for sonhms to handle trigger... console=${True} + Sleep 30s + END + ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/cps_expected_payload_fm.json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload}= Set Variable ${actual_data['payload']} + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() + + +Post pm notification to dmaap + ${data}= Get File ${TEST_ROBOT_DIR}/data/performance_notification.json + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_PM_NOTIF_URL}', data=$data) + Should Be Equal As Strings ${response.status_code} 200 + + +Verify pm notification trigger in sonhms + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 5 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for sonhms to handle trigger... console=${True} + Sleep 30s + END + ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/cps_expected_payload_pm.json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload}= Set Variable ${actual_data['payload']} + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() + + +Post policy negative acknowledgement to dmaap + ${data}= Get File ${TEST_ROBOT_DIR}/data/negative_ack_from_policy.json + FOR ${i} IN RANGE 3 + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_POLICY_RESPONSE}', data=$data) + END + Should Be Equal As Strings ${response.status_code} 200 + + +Oof trigger for fixed Pci cells + + Create Session dmaap ${DMAAP_URL} + ${headers}= Create Dictionary Content-Type application/json + ${data}= Get File ${TEST_ROBOT_DIR}/data/cps_fault_notification.json + ${response}= Evaluate requests.post('${POST_DMAAP_EVENT_FOR_FM_NOTIF_URL}', data=$data) + + Create Session dmaap ${DMAAP_URL} + FOR ${i} IN RANGE 15 + ${result}= Get Request dmaap ${unauthenticated.DCAE_CL_OUTPUT} + Exit For Loop If ${result.json()} != @{EMPTY} + Log Waiting for sonhms to handle trigger... console=${True} + Sleep 30s + END + ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/cps_expected_payload_fm.json + ${result}= Convert To String ${result.content} + ${result_string}= Get Substring ${result} 2 -2 + ${actual_data}= Evaluate json.loads("""${result_string}""") json + ${actual_payload}= Set Variable ${actual_data['payload']} + Should Be True """${actual_payload}""".strip() == """${expected_payload}""".strip() diff --git a/tests/dcaegen2-services-son-handler/testcases/sonhandler-test.robot b/tests/dcaegen2-services-son-handler/testcases/sonhandler-test.robot index 6e93ffb9..27a36053 100644 --- a/tests/dcaegen2-services-son-handler/testcases/sonhandler-test.robot +++ b/tests/dcaegen2-services-son-handler/testcases/sonhandler-test.robot @@ -63,7 +63,7 @@ Verify pm notification trigger in sonhms Log Waiting for sonhms to handle trigger... console=${True} Sleep 30s END - ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_pm.json + ${expected_payload}= Get File ${TEST_ROBOT_DIR}/data/expected_payload_pm.json ${result}= Convert To String ${result.content} ${result_string}= Get Substring ${result} 2 -2 ${actual_data}= Evaluate json.loads("""${result_string}""") json -- cgit 1.2.3-korg