Add messages validation in DCAE app simulator
This enhances assertions and makes sure that HV-VES does not mess
with measurements sent through GPB payload
Change-Id: I140e6c35abc72270e2af8c5b1749136e6732e02a
Issue-ID: DCAEGEN2-687
Signed-off-by: Filip Krzywka <filip.krzywka@nokia.com>
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
index 3e41366..c0a96db 100644
--- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
@@ -27,6 +27,9 @@
${DCAE_APP_API_MESSAGES_COUNT_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_COUNT_PATH}
Set Suite Variable ${DCAE_APP_API_MESSAGES_COUNT_URL} children=True
+ ${DCAE_APP_API_MESSAGES_VALIDATION_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_MESSAGES_VALIDATION_PATH}
+ Set Suite Variable ${DCAE_APP_API_MESSAGES_VALIDATION_URL} children=True
+
${DCAE_APP_API_TOPIC_CONFIGURATION_URL}= Catenate SEPARATOR= ${DCAE_APP_API_ACCESS} ${DCAE_APP_API_TOPIC_CONFIGURATION_PATH}
Wait until keyword succeeds 10 sec 5 sec
... Configure Dcae App Simulator To Consume Messages From Topics ${DCAE_APP_API_TOPIC_CONFIGURATION_URL} ${ROUTED_MESSAGES_TOPIC}
@@ -45,6 +48,7 @@
${DCAE_APP_API_MESSAGES_RESET_PATH} /messages
${DCAE_APP_API_MESSAGES_PATH} /messages/all
${DCAE_APP_API_MESSAGES_COUNT_PATH} ${DCAE_APP_API_MESSAGES_PATH}/count
+${DCAE_APP_API_MESSAGES_VALIDATION_PATH} ${DCAE_APP_API_MESSAGES_PATH}/validate
${ROUTED_MESSAGES_TOPIC} test-hv-ran-meas
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/hv-ves.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/hv-ves.robot
index 3ed6b92..6d8640a 100644
--- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/hv-ves.robot
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/hv-ves.robot
@@ -18,6 +18,7 @@
Wait until keyword succeeds 60 sec 5 sec
... Assert Dcae App Consumed ${DCAE_APP_API_MESSAGES_COUNT_URL} ${AMOUNT_25000}
+ Assert Dcae App Consumed Proper Messages ${DCAE_APP_API_MESSAGES_VALIDATION_URL} ${DCAE_FIXED_PAYLOAD_REQUEST}
*** Keywords ***
Message Routing Suite Setup
@@ -60,5 +61,6 @@
${VES_HV_SCENARIOS} %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
${XNF_FIXED_PAYLOAD_REQUEST} ${VES_HV_SCENARIOS}/fixed-payload/xnf-fixed-payload-request.json
+${DCAE_FIXED_PAYLOAD_REQUEST} ${VES_HV_SCENARIOS}/fixed-payload/dcae-fixed-payload-request.json
${AMOUNT_25000} 25000
\ No newline at end of file
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py
index 29e5b57..80a5c41 100644
--- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries/DcaeAppSimulatorLibrary.py
@@ -24,3 +24,13 @@
resp = HttpRequests.session_without_env().delete(app_url, timeout=5)
HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
+ def assert_DCAE_app_consumed_proper_messages(self, app_url, message_filepath):
+ logger.info("POST at: " + app_url)
+ file = open(message_filepath, "rb")
+ data = file.read()
+ file.close()
+
+ resp = HttpRequests.session_without_env().post(app_url, data=data, timeout=5)
+ HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
+
+
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json
new file mode 100644
index 0000000..fb53f50
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/fixed-payload/dcae-fixed-payload-request.json
@@ -0,0 +1,23 @@
+[
+ {
+ "commonEventHeader": {
+ "version": "sample-version",
+ "domain": "HVRANMEAS",
+ "sequence": 1,
+ "priority": 1,
+ "eventId": "sample-event-id",
+ "eventName": "sample-event-name",
+ "eventType": "sample-event-type",
+ "startEpochMicrosec": 120034455,
+ "lastEpochMicrosec": 120034455,
+ "nfNamingCode": "sample-nf-naming-code",
+ "nfcNamingCode": "sample-nfc-naming-code",
+ "reportingEntityId": "sample-reporting-entity-id",
+ "reportingEntityName": "sample-reporting-entity-name",
+ "sourceId": "sample-source-id",
+ "sourceName": "sample-source-name"
+ },
+ "messageType": "FIXED_PAYLOAD",
+ "messagesAmount": 25000
+ }
+]