diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot | 29 | ||||
-rwxr-xr-x | tests/dmaap-datarouter/dr-suite/dr-suite.robot | 69 | ||||
-rw-r--r-- | tests/usecases/5G-bulkpm/BulkpmE2E.robot | 17 | ||||
-rw-r--r-- | tests/usecases/5G-bulkpm/assets/metadata.schema.json | 74 | ||||
-rw-r--r-- | tests/usecases/5G-bulkpm/resources/JsonValidatorLibrary.py | 38 | ||||
-rw-r--r-- | tests/usecases/5G-bulkpm/resources/bulkpm_keywords.robot | 1 |
6 files changed, 198 insertions, 30 deletions
diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot index ccfa4968..1e3d9e91 100644 --- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot +++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot @@ -1,35 +1,32 @@ *** Settings *** Documentation Testing PM Mapper functionality -Resource ../../common.robot Library Collections -Library json Library OperatingSystem Library RequestsLibrary -Library HttpLibrary.HTTP -Library String Library Process *** Variables *** -${BC_URL} http://${DMAAPBC_IP}:8080/webapi -${CLI_EXEC_CLI} curl http://${CBS_IP}:10000/service_component/pmmapper -${FEED1_DATA} { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" } - +${CLI_EXEC_CLI_CONFIG} { head -n 5 | tail -1;} < /tmp/pmmapper.log +${CLI_EXEC_CLI_SUBS} curl -k https://${DR_PROV_IP}:8443/internal/prov *** Test Cases *** -Verify pmmapper configuration in consul through CBS +Verify PM Mapper Receive Configuraton From Config Binding Service [Tags] PM_MAPPER_01 - [Documentation] Verify pmmapper configuraiton in consul through CBS - ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI} shell=yes + [Documentation] Verify 3gpp pm mapper successfully receive config data from CBS + ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_CONFIG} shell=yes Log ${cli_cmd_output.stdout} - Should Contain ${cli_cmd_output.stdout} pm-mapper-filter + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} Received pm-mapper configuration -Create DR Feed through Bus Controller +Verify 3GPP PM Mapper Subscribes to Data Router [Tags] PM_MAPPER_02 - [Documentation] Create Feed on Data Router through Bus Controller - ${resp}= PostCall ${BC_URL}/feeds ${FEED1_DATA} - Should Be Equal As Integers ${resp.status_code} 200 + [Documentation] Verify 3gpp pm mapper subscribes to data router + ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_SUBS} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} 3gpppmmapper *** Keywords *** diff --git a/tests/dmaap-datarouter/dr-suite/dr-suite.robot b/tests/dmaap-datarouter/dr-suite/dr-suite.robot index 2270aee3..fb70326e 100755 --- a/tests/dmaap-datarouter/dr-suite/dr-suite.robot +++ b/tests/dmaap-datarouter/dr-suite/dr-suite.robot @@ -3,22 +3,30 @@ Library OperatingSystem Library RequestsLibrary Library requests Library Collections +Library Process Library String *** Variables *** -${TARGET_URL} https://${DR_PROV_IP}:8443 -${TARGET_URL_FEED} https://${DR_PROV_IP}:8443/feed/1 -${TARGET_URL_SUBSCRIBE} https://${DR_PROV_IP}:8443/subscribe/1 -${TARGET_URL_SUBSCRIPTION} https://${DR_PROV_IP}:8443/subs/1 -${TARGET_URL_PUBLISH_PROV} https://${DR_PROV_IP}:8443/publish/1/csit_test -${TARGET_URL_PUBLISH_NODE} https://${DR_NODE_IP}:8443/publish/1/csit_test -${CREATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}} -${UPDATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}} -${SUBSCRIBE_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"} -${UPDATE_SUBSCRIPTION_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"} -${FEED_CONTENT_TYPE} application/vnd.dmaap-dr.feed -${SUBSCRIBE_CONTENT_TYPE} application/vnd.dmaap-dr.subscription -${PUBLISH_FEED_CONTENT_TYPE} application/octet-stream +${TARGET_URL} https://${DR_PROV_IP}:8443 +${TARGET_URL_FEED} https://${DR_PROV_IP}:8443/feed/1 +${TARGET_URL_SUBSCRIBE} https://${DR_PROV_IP}:8443/subscribe/1 +${TARGET_URL_SUBSCRIPTION} https://${DR_PROV_IP}:8443/subs/1 +${TARGET_URL_PUBLISH_PROV} https://${DR_PROV_IP}:8443/publish/1/csit_test +${TARGET_URL_PUBLISH_NODE} https://${DR_NODE_IP}:8443/publish/1/csit_test +${TARGET_URL_DELETE_FILE} https://${DR_NODE_IP}:8443/delete/2 + +${FEED_CONTENT_TYPE} application/vnd.dmaap-dr.feed +${SUBSCRIBE_CONTENT_TYPE} application/vnd.dmaap-dr.subscription +${PUBLISH_FEED_CONTENT_TYPE} application/octet-stream + +${CREATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}} +${UPDATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}} +${SUBSCRIBE_DATA} {"delivery":{ "url":"http://${DR_SUB_IP}:7070/", "user":"LOGIN", "password":"PASSWORD", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n", "privilegedSubscriber":false} +${UPDATE_SUBSCRIPTION_DATA} {"delivery":{ "url":"http://${DR_SUB_IP}:7070/", "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n", "privilegedSubscriber":false} +${SUBSCRIBE2_DATA} {"delivery":{ "url":"http://${DR_SUB2_IP}:7070/", "user":"LOGIN", "password":"PASSWORD", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"privileged", "privilegedSubscriber":true} + +${CLI_VERIFY_SUB_RECEIVED_FILE} docker exec subscriber-node /bin/sh -c "ls /opt/app/subscriber/delivery | grep csit_test" +${CLI_VERIFY_FILE_REMAINS_ON_NODE} docker exec datarouter-node /bin/sh -c "ls /opt/app/datartr/spool/s/0/2 | grep dmaap-dr-node | grep -v .M" *** Test Cases *** Run Feed Creation @@ -39,7 +47,16 @@ Run Subscribe to Feed Should Be Equal As Strings ${resp.status_code} 201 log 'JSON Response Code:'${resp} -Run Publish Feed +Run Subscribe to Feed with Privileged Subscription + [Documentation] Subscribe to Feed with privileged subscription + [Timeout] 1 minute + ${resp}= PostCall ${TARGET_URL_SUBSCRIBE} ${SUBSCRIBE2_DATA} ${SUBSCRIBE_CONTENT_TYPE} privileged + log ${TARGET_URL_SUBSCRIBE} + log ${resp.text} + Should Be Equal As Strings ${resp.status_code} 201 + log 'JSON Response Code:'${resp} + +Run Publish to Feed [Documentation] Publish to Feed [Timeout] 1 minute Sleep 10s Behaviour was noticed where feed was not created in time for publish to be sent @@ -50,6 +67,30 @@ Run Publish Feed Should Be Equal As Strings ${resp.status_code} 204 log 'JSON Response Code:'${resp} +Verify Subscriber Received Published File + [Documentation] Verify file is delivered to datarouter-subscriber + [Timeout] 1 minute + Sleep 5s Time to allow subscriber to receive the file + ${cli_cmd_output}= Run Process ${CLI_VERIFY_SUB_RECEIVED_FILE} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} csit_test + + +Verify File Remains On Privileged Subscriber And Delete It + [Documentation] Verify file has not been deleted on datarouter-node and delete it using DELETE API + [Timeout] 1 minute + ${cli_cmd_output}= Run Process ${CLI_VERIFY_FILE_REMAINS_ON_NODE} shell=yes + log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} dmaap-dr-node + ${resp}= DeleteCall ${TARGET_URL_DELETE_FILE}/${cli_cmd_output.stdout} rs873m + Should Be Equal As Strings ${resp.status_code} 200 + log 'JSON Response Code:'${resp} + ${cli_cmd_output}= Run Process ${CLI_VERIFY_FILE_REMAINS_ON_NODE} shell=yes + log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 1 + Run Update Subscription [Documentation] Update Subscription to suspend and change delivery credentials [Timeout] 1 minute diff --git a/tests/usecases/5G-bulkpm/BulkpmE2E.robot b/tests/usecases/5G-bulkpm/BulkpmE2E.robot index 28de4c24..4b85e6ba 100644 --- a/tests/usecases/5G-bulkpm/BulkpmE2E.robot +++ b/tests/usecases/5G-bulkpm/BulkpmE2E.robot @@ -19,6 +19,11 @@ ${TARGETURL_SUBSCR} http://${DMAAP_MR_IP}:3904/events/unaut ${CLI_EXEC_CLI} curl -k https://${DR_PROV_IP}:8443/internal/prov ${CLI_EXEC_CLI_FILECONSUMER} docker exec fileconsumer-node /bin/sh -c "ls /opt/app/subscriber/delivery | grep .gz" +${CLI_EXEC_CLI_FILECONSUMER_CP} docker cp fileconsumer-node:/opt/app/subscriber/delivery/xNF.pm.xml.gz.M %{WORKSPACE} +${CLI_EXEC_RENAME_METADATA} mv %{WORKSPACE}/xNF.pm.xml.gz.M %{WORKSPACE}/metadata.json +${metadataSchemaPath} %{WORKSPACE}/tests/usecases/5G-bulkpm/assets/metadata.schema.json +${metadataJsonPath} %{WORKSPACE}/metadata.json + *** Test Cases *** Send VES File Ready Event to VES Collector @@ -77,3 +82,15 @@ Verify Fileconsumer Receive PM file from Data Router Log ${cli_cmd_output.stdout} Should Be Equal As Strings ${cli_cmd_output.rc} 0 Should Contain ${cli_cmd_output.stdout} xNF.pm.xml.gz + +Verify File Consumer Receive valid metadata from Data Router + [Tags] Bulk_PM_E2E_06 + [Documentation] Check PM XML file is delivered to the FileConsumer Simulator with valid metadata + ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER} shell=yes + Log ${cli_cmd_output.stdout} + Should Be Equal As Strings ${cli_cmd_output.rc} 0 + Should Contain ${cli_cmd_output.stdout} xNF.pm.xml.gz.M + ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_FILECONSUMER_CP} shell=yes + ${cli_cmd_output}= Run Process ${CLI_EXEC_RENAME_METADATA} shell=yes + ${validation_result}= Validate ${metadataSchemaPath} ${metadataJsonPath} + Should Be Equal As Strings ${validation_result} 0 diff --git a/tests/usecases/5G-bulkpm/assets/metadata.schema.json b/tests/usecases/5G-bulkpm/assets/metadata.schema.json new file mode 100644 index 00000000..a41b3544 --- /dev/null +++ b/tests/usecases/5G-bulkpm/assets/metadata.schema.json @@ -0,0 +1,74 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "metadata.schema.json", + "title": "DataRouter PM File Metadata", + "description": "Metadata for 3GPP PM files that are placed on the DMaaP Data Router by the Data File Collector (VES 7.1)", + "type": "object", + + "properties": { + "productName": { + "description": "from the FileReady event eventName", + "type": "string" + }, + + "vendorName": { + "description": "from the FileReady event eventName", + "type": "string" + }, + + "lastEpochMicrosec": { + "description": "the latest unix epoch time associated with the FileReady event", + "type": "string" + }, + + "sourceName": { + "description": "the name of the entity experiencing the event", + "type": "string" + }, + + "startEpochMicrosec": { + "description": "the earliest unix epoch time associated with the FileReady event", + "type": "string" + }, + + "timeZoneOffset": { + "description": "the timezone offset from UTC", + "type": "string", + "pattern": "^(?:(?:[a-zA-Z]{3})[+-](?:[01][0-9]|2[0-3]).[0-5][0-9])$" + }, + + "location": { + "description": "follows the format <protocol>://<ip address>:<port>/<path>/<filename>, the IP address is the node ip address, the port of the protocol server", + "type": "string" + }, + + "compression": { + "description": "specifies if the file is compressed", + "type": "string", + "enum": [ "gzip" ] + }, + + "fileFormatType": { + "description": "the file format", + "type": "string" + }, + + "fileFormatVersion": { + "description": "the version of the file format", + "type": "string" + } + }, + + "required": [ + "productName", + "vendorName", + "lastEpochMicrosec", + "sourceName", + "startEpochMicrosec", + "timeZoneOffset", + "location", + "compression", + "fileFormatType", + "fileFormatVersion" + ] +} diff --git a/tests/usecases/5G-bulkpm/resources/JsonValidatorLibrary.py b/tests/usecases/5G-bulkpm/resources/JsonValidatorLibrary.py new file mode 100644 index 00000000..12d5d856 --- /dev/null +++ b/tests/usecases/5G-bulkpm/resources/JsonValidatorLibrary.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +import sys +import logging +from simplejson import load +from jsonschema import validate, ValidationError, SchemaError + + +class JsonValidatorLibrary(object): + + def __init__(self): + pass + + def validate(self, schemaPath, jsonPath): + logging.info("Schema path: " + schemaPath) + logging.info("JSON path: " + jsonPath) + schema = None + data = None + try: + schema = load(open(schemaPath, 'r')) + data = load(open(jsonPath, 'r')) + except (IOError, ValueError, OSError) as e: + logging.error(e.message) + return 1 + + try: + validate(data, schema) + except (ValidationError, SchemaError) as e: + logging.error(e.message) + return 1 + + # logger.log("JSON validation successful") + print("JSON validation successful") + return 0 + +if __name__ == '__main__': + lib = JsonValidatorLibrary() + # sys.exit(JsonValidatorLibrary().validate(sys.argv[1], sys.argv[2])) diff --git a/tests/usecases/5G-bulkpm/resources/bulkpm_keywords.robot b/tests/usecases/5G-bulkpm/resources/bulkpm_keywords.robot index 6859ea0d..9ef56c83 100644 --- a/tests/usecases/5G-bulkpm/resources/bulkpm_keywords.robot +++ b/tests/usecases/5G-bulkpm/resources/bulkpm_keywords.robot @@ -2,6 +2,7 @@ Documentation The main interface for interacting with VES. It handles low level stuff like managing the http request library and VES required fields Library RequestsLibrary Library ../resources/xNFLibrary.py +Library ../resources/JsonValidatorLibrary.py Library OperatingSystem Library Collections Library requests |