Write HV-VES message routing testcases

Change-Id: Ibbee3deb1ebd5446f2251dc141a212cde892f374
Issue-ID: DCAEGEN2-687
Signed-off-by: jdudycz <jakub.dudycz@nokia.com>
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 6d8640a..482b698 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
@@ -20,6 +20,49 @@
     ...    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}
 
+
+Too big payload message handling
+    [Documentation]   VES-HV Collector should interrupt the stream when encountered message with too big payload
+
+    ${SIMULATORS_LIST}=   Get xNF Simulators   1
+    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_TOO_BIG_PAYLOAD_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed Less Equal Than   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_25000}
+
+
+Invalid wire frame message handling
+    [Documentation]  VES-HV Collector should skip messages with invalid wire frame
+
+    ${SIMULATORS_LIST}=   Get xNF Simulators   1
+    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_INVALID_WIRE_FRAME_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_50000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_INVALID_WIRE_FRAME_REQUEST}
+
+
+Invalid GPB data message handling
+    [Documentation]   VES-HV Collector should skip messages with invalid GPB data
+
+    ${SIMULATORS_LIST}=   Get xNF Simulators   1
+    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_INVALID_GPB_DATA_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}  ${AMOUNT_50000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_INVALID_GPB_DATA_REQUEST}
+
+
+Unsupported domain message handling
+    [Documentation]   VES-HV Collector should skip messages with unsupported domain
+
+    ${SIMULATORS_LIST}=   Get xNF Simulators   1
+    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_UNSUPPORTED_DOMAIN_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...    Assert Dcae App Consumed  ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_50000}
+    Assert Dcae App Consumed Proper Messages   ${DCAE_APP_API_MESSAGES_VALIDATION_URL}   ${DCAE_UNSUPPORTED_DOMAIN_REQUEST}
+
 *** Keywords ***
 Message Routing Suite Setup
     Log   Started Suite: VES-HV Message Routing
@@ -61,6 +104,15 @@
 
 ${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
+${XNF_TOO_BIG_PAYLOAD_REQUEST}                 ${VES_HV_SCENARIOS}/too-big-payload/xnf-too-big-payload-request.json
+${XNF_INVALID_WIRE_FRAME_REQUEST}              ${VES_HV_SCENARIOS}/invalid-wire-frame/xnf-invalid-wire-frame-request.json
+${XNF_INVALID_GPB_DATA_REQUEST}                ${VES_HV_SCENARIOS}/invalid-gpb-data/xnf-invalid-gpb-data-request.json
+${XNF_UNSUPPORTED_DOMAIN_REQUEST}              ${VES_HV_SCENARIOS}/unsupported-domain/xnf-unsupported-domain-request.json
 
-${AMOUNT_25000}                                25000
\ No newline at end of file
+${DCAE_FIXED_PAYLOAD_REQUEST}                  ${VES_HV_SCENARIOS}/fixed-payload/dcae-fixed-payload-request.json
+${DCAE_INVALID_WIRE_FRAME_REQUEST}             ${VES_HV_SCENARIOS}/invalid-wire-frame/dcae-invalid-wire-frame-request.json
+${DCAE_INVALID_GPB_DATA_REQUEST}               ${VES_HV_SCENARIOS}/invalid-gpb-data/dcae-invalid-gpb-data-request.json
+${DCAE_UNSUPPORTED_DOMAIN_REQUEST}             ${VES_HV_SCENARIOS}/unsupported-domain/dcae-unsupported-domain-request.json
+
+${AMOUNT_25000}                                25000
+${AMOUNT_50000}                                50000
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 80a5c41..ab3b1e2 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
@@ -3,6 +3,7 @@
 
 DCAE_APP_NAME = "DCAE App"
 
+
 class DcaeAppSimulatorLibrary:
 
     def configure_dcae_app_simulator_to_consume_messages_from_topics(self, app_url, topics):
@@ -18,6 +19,17 @@
         assert resp.content == expected_messages_amount, \
             "Messages consumed by simulator: " + resp.content + " expecting: " + expected_messages_amount
 
+    def assert_DCAE_app_consumed_less_equal_than(self, app_url, messages_threshold):
+        logger.info("GET at: " + app_url)
+        resp = HttpRequests.session_without_env().get(app_url, timeout=5)
+        HttpRequests.checkStatusCode(resp.status_code, DCAE_APP_NAME)
+
+        logger.debug("Messages consumed by simulator: " + resp.content +
+                     " expecting more than 0 and less/equal than " + messages_threshold)
+
+        assert 0 < int(resp.content) <= int(messages_threshold), \
+            "Messages consumed by simulator: " + resp.content + \
+            " expecting more than 0 and less/equal than " + messages_threshold
 
     def reset_DCAE_app_simulator(self, app_url):
         logger.info("DELETE at: " + app_url)
@@ -32,5 +44,3 @@
 
         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/invalid-gpb-data/dcae-invalid-gpb-data-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-request.json
new file mode 100644
index 0000000..772b03b
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/dcae-invalid-gpb-data-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": "VALID",
+    "messagesAmount": 50000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json
new file mode 100644
index 0000000..d9cb4c2
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-gpb-data/xnf-invalid-gpb-data-request.json
@@ -0,0 +1,65 @@
+[
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "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": "INVALID_GPB_DATA",
+    "messagesAmount": 100
+  },
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-request.json
new file mode 100644
index 0000000..772b03b
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/dcae-invalid-wire-frame-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": "VALID",
+    "messagesAmount": 50000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json
new file mode 100644
index 0000000..88d4e32
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/invalid-wire-frame/xnf-invalid-wire-frame-request.json
@@ -0,0 +1,65 @@
+[
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "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": "INVALID_WIRE_FRAME",
+    "messagesAmount": 100
+  },
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json
new file mode 100644
index 0000000..b1c727a
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/too-big-payload/xnf-too-big-payload-request.json
@@ -0,0 +1,65 @@
+[
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "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": "TOO_BIG_PAYLOAD",
+    "messagesAmount": 100
+  },
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-request.json
new file mode 100644
index 0000000..772b03b
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/dcae-unsupported-domain-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": "VALID",
+    "messagesAmount": 50000
+  }
+]
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json
new file mode 100644
index 0000000..e37e20d
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/unsupported-domain/xnf-unsupported-domain-request.json
@@ -0,0 +1,65 @@
+[
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  },
+  {
+    "commonEventHeader": {
+      "version": "sample-version",
+      "domain": "FAULT",
+      "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": "VALID",
+    "messagesAmount": 100
+  },
+  {
+    "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": "VALID",
+    "messagesAmount": 25000
+  }
+]