Write HV-VES testcase for SSL authorization

Change-Id: I4eeed5d3418c80d34ba8127bbbe9c49969a033ec
Issue-ID: DCAEGEN2-687
Signed-off-by: kjaniak <kornel.janiak@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 32e920b..c0a96db 100644
--- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/__init__.robot
@@ -17,7 +17,6 @@
     ${CONSUL_API_ACCESS}=   Get Consul Api Access Url   ${HTTP_METHOD_URL}   ${CONSUL_CONTAINER_HOST}   ${CONSUL_CONTAINER_PORT}
     ${CONSUL_API_URL}=  Catenate   SEPARATOR=   ${CONSUL_API_ACCESS}   ${CONSUL_VES_HV_CONFIGURATION_KEY_PATH}
     Publish HV VES Configuration In Consul    ${CONSUL_API_URL}   ${VES_HV_CONFIGURATION_JSON_FILEPATH}
-    Sleep   5
 
 Configure Dcae App
     ${DCAE_APP_API_ACCESS}=   Get Dcae App Api Access Url   ${HTTP_METHOD_URL}   ${DCAE_APP_CONTAINER_HOST}   ${DCAE_APP_CONTAINER_PORT}
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot
new file mode 100644
index 0000000..1b832f2
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/authorization.robot
@@ -0,0 +1,35 @@
+*** Settings ***
+Library       DcaeAppSimulatorLibrary
+
+Resource      resources/common-keywords.robot
+
+Suite Setup       Client Authorization Suite Setup
+Suite Teardown    VES-HV Collector Suite Teardown
+Test Teardown     VES-HV Collector Test Shutdown
+
+*** Keywords ***
+Client Authorization Suite Setup
+    Log   Started Suite: VES-HV Client Authorization
+    ${XNF_PORTS_LIST}=    Create List    7000
+    Configure Invalid xNF Simulators On Ports    ${XNF_PORTS_LIST}
+    Log   Suite setup finished
+
+
+*** Test Cases ***
+Authorization
+    [Documentation]   VES-HV Collector should not authorize XNF with invalid certificate and not route any message
+    ...               to topics
+
+    ${SIMULATORS_LIST}=   Get Invalid xNF Simulators   1
+    Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_VALID_MESSAGES_REQUEST}
+
+    Wait until keyword succeeds   60 sec   5 sec
+    ...     Assert Dcae App Consumed   ${DCAE_APP_API_MESSAGES_COUNT_URL}   ${AMOUNT_0}
+
+
+*** Variables ***
+${VES_HV_SCENARIOS}                            %{WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios
+
+${XNF_VALID_MESSAGES_REQUEST}                  ${VES_HV_SCENARIOS}/authorization/xnf-valid-messages-request.json
+
+${AMOUNT_0}                                    0
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot
index bac8539..862a2bc 100644
--- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/multiple-clients.robot
@@ -11,14 +11,14 @@
 Multiple Clients Handling Suite Setup
     Log   Started Suite: VES-HV Multiple Clients Handling
     ${XNF_PORTS_LIST}=    Create List    7000   7001   7002
-    Configure xNF Simulators On Ports    ${XNF_PORTS_LIST}
+    Configure Valid xNF Simulators On Ports    ${XNF_PORTS_LIST}
     Log   Suite setup finished
 
 *** Test Cases ***
 Handle Multiple Connections
     [Documentation]   VES-HV Collector should handle multiple incoming transmissions
 
-    ${SIMULATORS_LIST}=   Get xNF Simulators   3
+    ${SIMULATORS_LIST}=   Get Valid xNF Simulators   3
     Send Messages From xNF Simulators   ${SIMULATORS_LIST}   ${XNF_SMALLER_PAYLOAD_REQUEST}
 
     Wait until keyword succeeds   60 sec   5 sec
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
index af4cd71..3451186 100644
--- a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/common-keywords.robot
@@ -4,15 +4,27 @@
 Library       Collections
 
 *** Keywords ***
-Configure xNF Simulators On Ports
+Configure Valid xNF Simulators On Ports
     [Arguments]    ${XNF_PORTS_LIST}
-    ${XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators    ${XNF_PORTS_LIST}    True
-    Set Suite Variable    ${XNF_SIMULATORS_ADDRESSES}
+    ${VALID_XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators    ${XNF_PORTS_LIST}    True
+    Set Suite Variable    ${VALID_XNF_SIMULATORS_ADDRESSES}
 
 
-Get xNF Simulators
+Configure Invalid xNF Simulators On Ports
+    [Arguments]    ${XNF_PORTS_LIST}
+    ${INVALID_XNF_SIMULATORS_ADDRESSES}=   Start Xnf Simulators    ${XNF_PORTS_LIST}    False
+    Set Suite Variable    ${INVALID_XNF_SIMULATORS_ADDRESSES}
+
+
+Get Valid xNF Simulators
     [Arguments]  ${AMOUNT}
-    ${SIMULATORS}=   Get Slice From List   ${XNF_SIMULATORS_ADDRESSES}   0   ${AMOUNT}
+    ${SIMULATORS}=   Get Slice From List   ${VALID_XNF_SIMULATORS_ADDRESSES}   0   ${AMOUNT}
+    [Return]   ${SIMULATORS}
+
+
+Get Invalid xNF Simulators
+    [Arguments]  ${AMOUNT}
+    ${SIMULATORS}=   Get Slice From List   ${INVALID_XNF_SIMULATORS_ADDRESSES}   0   ${AMOUNT}
     [Return]   ${SIMULATORS}
 
 
diff --git a/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-request.json
new file mode 100644
index 0000000..c71793d
--- /dev/null
+++ b/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/resources/scenarios/authorization/xnf-valid-messages-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": 500000
+  }
+]
\ No newline at end of file