diff options
Diffstat (limited to 'tests')
23 files changed, 272 insertions, 42 deletions
diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json index 2ffe356f..cdcab678 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV4.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"10.17.123.234", - "oamV6IpAddress":"" + "oamV6IpAddress":"", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json index c4a0e727..f5ec23d0 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_IPV6.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"", - "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334" + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2e:0370:7334", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json index 16963e1b..bc9cb1d3 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_all_fields.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"10.16.123.234", - "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334" + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_empty_addtional_fields.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_empty_addtional_fields.json new file mode 100644 index 00000000..7ca4d0c6 --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_empty_addtional_fields.json @@ -0,0 +1,17 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.16.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", + "serial-number":"", + "equip-vendor":"", + "equip-model":"", + "equip-type":"", + "nf-role":"", + "sw-version":"" + } + } +} diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json index 1e3afa9d..4942a3d5 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_IPV4_and_IPV6.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"", - "oamV6IpAddress":"" + "oamV6IpAddress":"", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_additional_fields.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_additional_fields.json new file mode 100644 index 00000000..16963e1b --- /dev/null +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_additional_fields.json @@ -0,0 +1,11 @@ +{ + "event": { + "commonEventHeader": { + "sourceName":"NOK6061ZW1" + }, + "pnfRegistrationFields": { + "oamV4IpAddress":"10.16.123.234", + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334" + } + } +} diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json index 126987fd..5e2a6121 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"10.18.123.234", - "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334" + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2a:0370:7334", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json index de1f576c..a6a6f364 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_IPV4_and_IPV6.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"", - "oamV6IpAddress":"" + "oamV6IpAddress":"", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json index 4838f1b0..6d9eadfe 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV4.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"", - "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334" + "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8b2f:0370:7334", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json index 04ab7ceb..9fac5b19 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_with_missing_sourceName_and_IPV6.json @@ -5,7 +5,13 @@ }, "pnfRegistrationFields": { "oamV4IpAddress":"10.17.163.234", - "oamV6IpAddress":"" + "oamV6IpAddress":"", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json b/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json index 0aa0372c..a416bb7e 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/event_without_IPV6_field.json @@ -4,7 +4,13 @@ "sourceName":"NOK6061ZW9" }, "pnfRegistrationFields": { - "oamV4IpAddress":"10.17.123.24" + "oamV4IpAddress":"10.17.123.24", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion" } } } diff --git a/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json b/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json index c87e188f..08d9a49c 100644 --- a/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json +++ b/tests/dcaegen2/prh-testcases/assets/json_events/not_json_format.json @@ -6,6 +6,12 @@ "pnfRegistrationFields": { "oamV4IpAddress":"10.16.123.234", "oamV6IpAddress":"2001:0db8:85a3:0000:0000:8a2e:0370:7334", + "serial-number":"NOkkaaa123", + "equip-vendor":"equipVendor", + "equip-model":"equipModel", + "equip-type":"equipType", + "nf-role":"nf-role", + "sw-version":"swVersion", } } } diff --git a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py index dc589369..d413be58 100644 --- a/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py +++ b/tests/dcaegen2/prh-testcases/resources/PrhLibrary.py @@ -24,8 +24,14 @@ class PrhLibrary(object): json_to_python = json.loads(json_file) ipv4 = json_to_python.get("event").get("pnfRegistrationFields").get("oamV4IpAddress") ipv6 = json_to_python.get("event").get("pnfRegistrationFields").get("oamV6IpAddress") if "oamV6IpAddress" in json_to_python["event"]["pnfRegistrationFields"] else "" + serial_number = json_to_python.get("event").get("pnfRegistrationFields").get("serial-number") if "serial-number" in json_to_python["event"]["pnfRegistrationFields"] else "" + equip_vendor = json_to_python.get("event").get("pnfRegistrationFields").get("equip-vendor") if "equip-vendor" in json_to_python["event"]["pnfRegistrationFields"] else "" + equip_model = json_to_python.get("event").get("pnfRegistrationFields").get("equip-model") if "equip-model" in json_to_python["event"]["pnfRegistrationFields"] else "" + equip_type = json_to_python.get("event").get("pnfRegistrationFields").get("equip-type") if "equip-type" in json_to_python["event"]["pnfRegistrationFields"] else "" + nf_role = json_to_python.get("event").get("pnfRegistrationFields").get("nf-role") if "nf-role" in json_to_python["event"]["pnfRegistrationFields"] else "" + sw_version = json_to_python.get("event").get("pnfRegistrationFields").get("sw-version") if "sw-version" in json_to_python["event"]["pnfRegistrationFields"] else "" correlation_id = json_to_python.get("event").get("commonEventHeader").get("sourceName") - str_json = '{"correlationId":"' + correlation_id + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '"}' + str_json = '{"correlationId":"' + correlation_id + '","ipaddress-v4-oam":"' + ipv4 + '","ipaddress-v6-oam":"' + ipv6 + '","serial-number":"' + serial_number + '","equip-vendor":"' + equip_vendor + '","equip-model":"' + equip_model + '","equip-type":"' + equip_type + '","nf-role":"' + nf_role + '","sw-version":"' + sw_version + '"}' python_to_json = json.dumps(str_json) return python_to_json.replace("\\", "")[1:-1] diff --git a/tests/policy/api/api-test.robot b/tests/policy/api/api-test.robot index 3753b3d8..7ea24738 100644 --- a/tests/policy/api/api-test.robot +++ b/tests/policy/api/api-test.robot @@ -8,8 +8,8 @@ Library json Healthcheck [Documentation] Runs Policy Api Health check ${auth}= Create List healthcheck zb!XztG34 - Log Creating session http://${POLICY_API_IP}:6969 - ${session}= Create Session policy http://${POLICY_API_IP}:6969 auth=${auth} + Log Creating session https://${POLICY_API_IP}:6969 + ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= Get Request policy /healthcheck headers=${headers} Log Received response from policy ${resp.text} @@ -19,10 +19,10 @@ Healthcheck Statistics [Documentation] Runs Policy Api Statistics ${auth}= Create List healthcheck zb!XztG34 - Log Creating session http://${POLICY_API_IP}:6969 - ${session}= Create Session policy http://${POLICY_API_IP}:6969 auth=${auth} + Log Creating session https://${POLICY_API_IP}:6969 + ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= Get Request policy /statistics headers=${headers} Log Received response from policy ${resp.text} Should Be Equal As Strings ${resp.status_code} 200 - Should Be Equal As Strings ${resp.json()['code']} 200
\ No newline at end of file + Should Be Equal As Strings ${resp.json()['code']} 200 diff --git a/tests/policy/distribution/distribution-test.robot b/tests/policy/distribution/distribution-test.robot index 1b9fa212..2ee11806 100644 --- a/tests/policy/distribution/distribution-test.robot +++ b/tests/policy/distribution/distribution-test.robot @@ -8,8 +8,8 @@ Library json Healthcheck [Documentation] Runs Policy Distribution Health check ${auth}= Create List healthcheck zb!XztG34 - Log Creating session http://${POLICY_DISTRIBUTION_IP}:6969 - ${session}= Create Session policy http://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth} + Log Creating session https://${POLICY_DISTRIBUTION_IP}:6969 + ${session}= Create Session policy https://${POLICY_DISTRIBUTION_IP}:6969 auth=${auth} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json ${resp}= Get Request policy /healthcheck headers=${headers} Log Received response from policy ${resp.text} diff --git a/tests/policy/pap/pap-test.robot b/tests/policy/pap/pap-test.robot new file mode 100644 index 00000000..7dca5b4d --- /dev/null +++ b/tests/policy/pap/pap-test.robot @@ -0,0 +1,28 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Test Cases *** +Healthcheck + [Documentation] Runs Policy PAP Health check + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${POLICY_PAP_IP}:6969 + ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy /healthcheck headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['code']} 200 + +Statistics + [Documentation] Runs Policy PAP Statistics + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${POLICY_PAP_IP}:6969 + ${session}= Create Session policy https://${POLICY_PAP_IP}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= Get Request policy /statistics headers=${headers} + Log Received response from policy ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['code']} 200 diff --git a/tests/usecases/5G-bulkpm/BulkpmE2E.robot b/tests/usecases/5G-bulkpm/BulkpmE2E.robot index fcc1cc76..4b85e6ba 100644 --- a/tests/usecases/5G-bulkpm/BulkpmE2E.robot +++ b/tests/usecases/5G-bulkpm/BulkpmE2E.robot @@ -8,7 +8,7 @@ Resource resources/bulkpm_keywords.robot *** Variables *** -${VESC_URL} http://%{VESC_IP}:8080 +${VESC_URL} http://%{VESC_IP}:%{VESC_PORT} ${GLOBAL_APPLICATION_ID} robot-ves ${VES_ANY_EVENT_PATH} /eventListener/v7 ${HEADER_STRING} content-type=application/json @@ -17,9 +17,13 @@ ${EVENT_DATA_FILE} %{WORKSPACE}/tests/usecases/5G-bulkpm/a ${TARGETURL_TOPICS} http://${DMAAP_MR_IP}:3904/topics ${TARGETURL_SUBSCR} http://${DMAAP_MR_IP}:3904/events/unauthenticated.VES_NOTIFICATION_OUTPUT/OpenDcae-c12/C12?timeout=1000 ${CLI_EXEC_CLI} curl -k https://${DR_PROV_IP}:8443/internal/prov -${CLI_EXEC_CLI_DFC} docker exec dfc /bin/sh -c "ls /target | grep .gz" ${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 @@ -55,7 +59,7 @@ Check VES Notification Topic is existing in Message Router Verify Downloaded PM file from xNF exist on Data File Collector [Tags] Bulk_PM_E2E_03 [Documentation] Check the PM XML file exists on the data file collector - ${cli_cmd_output}= Run Process ${CLI_EXEC_CLI_DFC} shell=yes + ${cli_cmd_output}= Run Process %{CLI_EXEC_CLI_DFC} 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 @@ -78,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/json_events/FileExistNotification.json b/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json index 4064ea31..d5d8fd05 100644 --- a/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json +++ b/tests/usecases/5G-bulkpm/assets/json_events/FileExistNotification.json @@ -21,7 +21,7 @@ "arrayOfNamedHashMap": [ { "name": "xNF.pm.xml.gz", "hashMap":{ - "location": "sftp://admin:admin@sftpserver:22/xNF.pm.xml.gz", + "location": "sftp://admin:admin@sftpserver:sftpport/xNF.pm.xml.gz", "compression": "gzip", "fileFormatType": "org.3GPP.32.435#measCollec", "fileFormatVersion": "V10" 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 diff --git a/tests/vvp/sanity/__init__.robot b/tests/vvp/sanity/__init__.robot deleted file mode 100644 index 6bc0362e..00000000 --- a/tests/vvp/sanity/__init__.robot +++ /dev/null @@ -1,2 +0,0 @@ -*** Settings *** -Documentation VVP - HealthCheck diff --git a/tests/vvp/sanity/test1.robot b/tests/vvp/sanity/test1.robot deleted file mode 100644 index 27612fdb..00000000 --- a/tests/vvp/sanity/test1.robot +++ /dev/null @@ -1,19 +0,0 @@ -*** Settings *** -Library Collections -Library OperatingSystem -Library RequestsLibrary -Library json - -# http://localhost:9090/vvp/v1/engmgr/vendors -# vvp-engagementmgr - -*** Test Cases *** -Get Requests health check ok - [Tags] get - CreateSession vvp-engagementmgr http://localhost:9090 - ${headers}= Create Dictionary Accept=application/json Content-Type=application/json - ${resp}= Get Request vvp-engagementmgr /vvp/v1/engmgr/vendors headers=&{headers} - Should Be Equal As Strings ${resp.status_code} 200 - @{ITEMS}= Copy List ${resp.json()} - : FOR ${ELEMENT} IN @{ITEMS} - \ Log ${ELEMENT['uuid']} ${ELEMENT['name']} |