From 1ed10864e7426bee6d0e8084171a60885692545b Mon Sep 17 00:00:00 2001 From: Bartosz Gardziejewski Date: Thu, 6 May 2021 10:56:51 +0200 Subject: Rename PM_Dictionary_Validator to Dictionary_Validator Signed-off-by: Bartosz Gardziejewski Change-Id: I7009b52b71d630aa52435ac69b4339ff4aecc74b Issue-ID: VNFSDK-769 --- docs/files/VNFSDK-LFN-CVC.rst | 2 +- .../VNFSDK-Marketplace-userguide-rest-api.rst | 6 +- docs/files/dictionary-validation.rst | 230 +++++++++++++++++++++ docs/files/pm-validation.rst | 230 --------------------- 4 files changed, 234 insertions(+), 234 deletions(-) create mode 100644 docs/files/dictionary-validation.rst delete mode 100644 docs/files/pm-validation.rst (limited to 'docs') diff --git a/docs/files/VNFSDK-LFN-CVC.rst b/docs/files/VNFSDK-LFN-CVC.rst index f9abbd4..440cc32 100644 --- a/docs/files/VNFSDK-LFN-CVC.rst +++ b/docs/files/VNFSDK-LFN-CVC.rst @@ -44,4 +44,4 @@ CVC Structures vnf-test-platform.rst csar-validation.rst - pm-validation.rst + dictionary-validation.rst diff --git a/docs/files/VNFSDK-Marketplace-userguide-rest-api.rst b/docs/files/VNFSDK-Marketplace-userguide-rest-api.rst index f77370c..02fff45 100644 --- a/docs/files/VNFSDK-Marketplace-userguide-rest-api.rst +++ b/docs/files/VNFSDK-Marketplace-userguide-rest-api.rst @@ -162,13 +162,13 @@ Response: { "passed": false, "vnfreqName": "r816745", - "description": "The VNF or PNF PROVIDER MUST provide the Service Provider with PM Meta Data (PM Dictionary)\nto support the analysis of PM events delivered to DCAE.\nThe PM Dictionary is to be provided as a separate YAML artifact at onboarding and must follow\nthe VES Event Listener Specification and VES Event Registration Specification\nwhich contain the format and content required.", + "description": "The VNF or PNF PROVIDER MUST provide the Service Provider with Meta Data (Dictionary)\nto support the analysis of events delivered to DCAE.\nThe Dictionary is to be provided as a separate YAML artifact at onboarding and must follow\nthe VES Event Listener Specification and VES Event Registration Specification\nwhich contain the format and content required.", "errors": [ { "vnfreqNo": "R816745", "code": "0x2000", - "message": "Fail to load PM_Dictionary With error: PM_Dictionary YAML file is empty", - "file": "Artifacts/Deployment/Measurements/PM_Dictionary.yml", + "message": "Fail to load Dictionary With error: Dictionary YAML file is empty", + "file": "Artifacts/Deployment/Measurements/Dictionary.yml", "lineNumber": -1 } ], diff --git a/docs/files/dictionary-validation.rst b/docs/files/dictionary-validation.rst new file mode 100644 index 0000000..6cfd67e --- /dev/null +++ b/docs/files/dictionary-validation.rst @@ -0,0 +1,230 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 +.. Copyright 2020 Nokia + +.. _dictionary_validation: + +VNFSDK Dictionary Validation User Guide +========================================== + +Library was created to validate Dictionary YAML files which are used in a xNF ETSI NFV onboarding packages - CSAR files. + +Basic information +------------------ + +The Dictionary validation library has two versions: + +- validation-dictionary-.jar contains Dictionary YAML validation logic which can be used by any ONAP component. Currently it is used by VNFSDK and SDC. + +- validation-dictionary--standalone.jar contains Dictionary YAML validation logic which can be run from command line. + +The Dictionary validation can be started in the two ways: + +- as a standalone application +- using an Oclip command + +Release Note +------------ + +The standalone version of Dictionary validation library is available from Honolulu release. + +How to download standalone version +---------------------------------- + +All available jars are available at +:: + https://nexus.onap.org/#nexus-search;quick~validation-dictionary + +To download a standalone version of Dictionary validation library you need to prepare a link for selected version of file or +manually download the file from Nexus (Viewing Repository: Releases). + +Template +:: + wget -O validation-dictionary--standalone.jar https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.vnfsdk.validation&a=validation-dictionary&v=&e=jar&c=standalone + +For example link for version 1.2.16 looks like +:: + wget -O validation-dictionary-1.2.16-standalone.jar https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.vnfsdk.validation&a=validation-dictionary&v=1.2.16&e=jar&c=standalone + +Application return codes +------------------------ + +=========== =========== +Return code Description +=========== =========== +0 No errors, validation passed +1 Validation fails +2 Internal application error +=========== =========== + +Application outputs +------------------- + +================ =========== +Output Description +================ =========== +Console All information's about operation progress, result and errors are logged at user console. +Log file Application creates a log file where all information's generated by application are logged. +Result json file Validation result is also available in the file with postfix '-validation-results.json'. The File is stored in a folder with input dictionary file. +================ =========== + +How to run standalone application? +---------------------------------- + +1. Install Java 11 JRE +2. Download standalone version of Dictionary YAML validation application + +For example +:: + wget -O validation-dictionary-1.2.16-standalone.jar https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.vnfsdk.validation&a=validation-dictionary&v=1.2.16&e=jar&c=standalone + +3. Go to folder with downloaded application and run it +:: + java -jar validation-dictionary-1.2.16-standalone.jar + +Examples +-------- + +1. Successful validation +:: + ❯ java -jar validation-dictionary-1.2.16-standalone.jar /home/username/yaml_schema/Simple_Valid_Schema.yaml + + # Executing a 'Validate Dictionary yaml' operation ... + # ... Done. + + # Operation result: + + { + "file": "/home/username/yaml_schema/Simple_Valid_Schema.yaml", + "status": "PASS", + "errors": [] + } + + # Result was stored in a file: '/home/username/yaml_schema/Simple_Valid_Schema-validation-results.json' + + # Application exits successfully. + + ❯ echo $? + 0 + + ❯ cat Simple_Valid_Schema-validation-results.json + + { + "file": "/home/username/yaml_schema/Simple_Valid_Schema.yaml", + "status": "PASS", + "errors": [] + } + + +2. Failing validation +:: + ❯ java -jar validation-dictionary-1.2.16-standalone.jar /home/username/yaml_schema/Dictionary.yaml + + # Executing a 'Validate Dictionary yaml' operation ... + # ... Done. + + # Operation result: + + { + "file": "/home/username/yaml_schema/Dictionary.yaml", + "status": "FAILED", + "errors": [ + { + "yamlDocumentNumber": 1, + "path": "/MetaData/Fields/measResultType", + "message": "Value(s) is/are not in array of accepted values.\n value(s): integer\n accepted value(s): [float, uint32, uint64]" + }, + { + "yamlDocumentNumber": 1, + "path": "/MetaData/Fields/", + "message": "Key not found: measChangeType" + }, + { + "yamlDocumentNumber": 2, + "path": "/MetaData/Fields/", + "message": "Key not found: measChangeType" + }, + { + "yamlDocumentNumber": 3, + "path": "/MetaData/Fields/measAdditionalFields/vendorField1", + "message": "Value(s) is/are not in array of accepted values.\n value(s): [Z, A]\n accepted value(s): [X, Y, Z]" + } + ] + } + + # Result was stored in a file: '/home/username/yaml_schema/Dictionary-validation-results.json' + + # Application exits successfully. + + ❯ echo $? + 1 + + ❯ cat /home/username/yaml_schema/Dictionary-validation-results.json + + { + "file": "/home/username/yaml_schema/Dictionary.yaml", + "status": "FAILED", + "errors": [ + { + "yamlDocumentNumber": 1, + "path": "/MetaData/Fields/measResultType", + "message": "Value(s) is/are not in array of accepted values.\n value(s): integer\n accepted value(s): [float, uint32, uint64]" + }, + { + "yamlDocumentNumber": 1, + "path": "/MetaData/Fields/", + "message": "Key not found: measChangeType" + }, + { + "yamlDocumentNumber": 2, + "path": "/MetaData/Fields/", + "message": "Key not found: measChangeType" + }, + { + "yamlDocumentNumber": 3, + "path": "/MetaData/Fields/measAdditionalFields/vendorField1", + "message": "Value(s) is/are not in array of accepted values.\n value(s): [Z, A]\n accepted value(s): [X, Y, Z]" + } + ] + } + +3. Validation internal error +:: + ❯ java -jar validation-dictionary-1.2.16-standalone.jar /home/username/Not_Yaml_File.txt + + # Executing a 'Validate Dictionary yaml' operation ... + # Command error: + Provided yaml file has invalid structure!, more information in log file. + + # Application fails with internal error. + + ❯ echo $? + 2 + + ❯ cat dictionary-validate.log + + 2020-12-14 08:23:31,054 ERROR o.o.v.y.YamlLoader [main] Failed to load multi document YAML file + ... + +How to run Dictionary YAML validation as an Oclip command? +------------------------------------------------------------- + +1. Run Oclip and execute a command: + +Command +:: + oclip --product onap-honolulu dictionary-validate --yaml + +For example +:: + vnfadmin@ddc559540515:/tmp$ oclip --product onap-honolulu dictionary-validate --yaml /tmp/Simple_Valid_Schema.yaml + {"file":"/tmp/Simple_Valid_Schema.yaml","date":"Mon Dec 28 07:38:43 UTC 2020","criteria":"PASS","errors":"[]"} + + vnfadmin@ddc559540515:/tmp$ oclip --product onap-honolulu dictionary-validate --yaml /tmp/Dictionary.yaml + {"file":"/tmp/Dictionary.yaml","date":"Mon Dec 28 07:38:08 UTC 2020","criteria":"FAILED","errors":" + [{\"yamlDocumentNumber\":1,\"path\":\"/MetaData/Fields/measResultType\", + \"message\":\"Value(s) is/are not in array of accepted values.\\n value(s): integer\\n accepted value(s): + [float, uint32, uint64]\"},{\"yamlDocumentNumber\":1,\"path\":\"/MetaData/Fields/\",\"message\":\"Key not found: measChangeType\"}, + {\"yamlDocumentNumber\":2,\"path\":\"/MetaData/Fields/\",\"message\":\"Key not found: measChangeType\"}, + {\"yamlDocumentNumber\":3,\"path\":\"/MetaData/Fields/measAdditionalFields/vendorField1\", + \"message\":\"Value(s) is/are not in array of accepted values.\\n value(s): [Z, A]\\n accepted value(s): [X, Y, Z]\"}]"} diff --git a/docs/files/pm-validation.rst b/docs/files/pm-validation.rst deleted file mode 100644 index 204a5c7..0000000 --- a/docs/files/pm-validation.rst +++ /dev/null @@ -1,230 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 -.. Copyright 2020 Nokia - -.. _pm-validation: - -VNFSDK PM Dictionary Validation User Guide -========================================== - -Library was created to validate PM Dictionary YAML files which are used in a xNF ETSI NFV onboarding packages - CSAR files. - -Basic information ------------------- - -The PM Dictionary validation library has two versions: - -- validation-pmdictionary-.jar contains PM Dictionary YAML validation logic which can be used by any ONAP component. Currently it is used by VNFSDK and SDC. - -- validation-pmdictionary--standalone.jar contains PM Dictionary YAML validation logic which can be run from command line. - -The PM Dictionary validation can be started in the two ways: - -- as a standalone application -- using an Oclip command - -Release Note ------------- - -The standalone version of PM Dictionary validation library is available from Honolulu release. - -How to download standalone version ----------------------------------- - -All available jars are available at -:: - https://nexus.onap.org/#nexus-search;quick~validation-pmdictionary - -To download a standalone version of PM Dictionary validation library you need to prepare a link for selected version of file or -manually download the file from Nexus (Viewing Repository: Releases). - -Template -:: - wget -O validation-pmdictionary--standalone.jar https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.vnfsdk.validation&a=validation-pmdictionary&v=&e=jar&c=standalone - -For example link for version 1.2.16 looks like -:: - wget -O validation-pmdictionary-1.2.16-standalone.jar https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.vnfsdk.validation&a=validation-pmdictionary&v=1.2.16&e=jar&c=standalone - -Application return codes ------------------------- - -=========== =========== -Return code Description -=========== =========== -0 No errors, validation passed -1 Validation fails -2 Internal application error -=========== =========== - -Application outputs -------------------- - -================ =========== -Output Description -================ =========== -Console All information's about operation progress, result and errors are logged at user console. -Log file Application creates a log file where all information's generated by application are logged. -Result json file Validation result is also available in the file with postfix '-validation-results.json'. The File is stored in a folder with input PM dictionary file. -================ =========== - -How to run standalone application? ----------------------------------- - -1. Install Java 11 JRE -2. Download standalone version of PM Dictionary YAML validation application - -For example -:: - wget -O validation-pmdictionary-1.2.16-standalone.jar https://nexus.onap.org/service/local/artifact/maven/redirect?r=snapshots&g=org.onap.vnfsdk.validation&a=validation-pmdictionary&v=1.2.16&e=jar&c=standalone - -3. Go to folder with downloaded application and run it -:: - java -jar validation-pmdictionary-1.2.16-standalone.jar - -Examples --------- - -1. Successful validation -:: - ❯ java -jar validation-pmdictionary-1.2.16-standalone.jar /home/username/yaml_schema/Simple_Valid_Schema.yaml - - # Executing a 'Validate PM Dictionary yaml' operation ... - # ... Done. - - # Operation result: - - { - "file": "/home/username/yaml_schema/Simple_Valid_Schema.yaml", - "status": "PASS", - "errors": [] - } - - # Result was stored in a file: '/home/username/yaml_schema/Simple_Valid_Schema-validation-results.json' - - # Application exits successfully. - - ❯ echo $? - 0 - - ❯ cat Simple_Valid_Schema-validation-results.json - - { - "file": "/home/username/yaml_schema/Simple_Valid_Schema.yaml", - "status": "PASS", - "errors": [] - } - - -2. Failing validation -:: - ❯ java -jar validation-pmdictionary-1.2.16-standalone.jar /home/username/yaml_schema/PM_Dictionary.yaml - - # Executing a 'Validate PM Dictionary yaml' operation ... - # ... Done. - - # Operation result: - - { - "file": "/home/username/yaml_schema/PM_Dictionary.yaml", - "status": "FAILED", - "errors": [ - { - "yamlDocumentNumber": 1, - "path": "/pmMetaData/pmFields/measResultType", - "message": "Value(s) is/are not in array of accepted values.\n value(s): integer\n accepted value(s): [float, uint32, uint64]" - }, - { - "yamlDocumentNumber": 1, - "path": "/pmMetaData/pmFields/", - "message": "Key not found: measChangeType" - }, - { - "yamlDocumentNumber": 2, - "path": "/pmMetaData/pmFields/", - "message": "Key not found: measChangeType" - }, - { - "yamlDocumentNumber": 3, - "path": "/pmMetaData/pmFields/measAdditionalFields/vendorField1", - "message": "Value(s) is/are not in array of accepted values.\n value(s): [Z, A]\n accepted value(s): [X, Y, Z]" - } - ] - } - - # Result was stored in a file: '/home/username/yaml_schema/PM_Dictionary-validation-results.json' - - # Application exits successfully. - - ❯ echo $? - 1 - - ❯ cat /home/username/yaml_schema/PM_Dictionary-validation-results.json - - { - "file": "/home/username/yaml_schema/PM_Dictionary.yaml", - "status": "FAILED", - "errors": [ - { - "yamlDocumentNumber": 1, - "path": "/pmMetaData/pmFields/measResultType", - "message": "Value(s) is/are not in array of accepted values.\n value(s): integer\n accepted value(s): [float, uint32, uint64]" - }, - { - "yamlDocumentNumber": 1, - "path": "/pmMetaData/pmFields/", - "message": "Key not found: measChangeType" - }, - { - "yamlDocumentNumber": 2, - "path": "/pmMetaData/pmFields/", - "message": "Key not found: measChangeType" - }, - { - "yamlDocumentNumber": 3, - "path": "/pmMetaData/pmFields/measAdditionalFields/vendorField1", - "message": "Value(s) is/are not in array of accepted values.\n value(s): [Z, A]\n accepted value(s): [X, Y, Z]" - } - ] - } - -3. Validation internal error -:: - ❯ java -jar validation-pmdictionary-1.2.16-standalone.jar /home/username/Not_Yaml_File.txt - - # Executing a 'Validate PM Dictionary yaml' operation ... - # Command error: - Provided yaml file has invalid structure!, more information in log file. - - # Application fails with internal error. - - ❯ echo $? - 2 - - ❯ cat pmdictionary-validate.log - - 2020-12-14 08:23:31,054 ERROR o.o.v.y.YamlLoader [main] Failed to load multi document YAML file - ... - -How to run PM Dictionary YAML validation as an Oclip command? -------------------------------------------------------------- - -1. Run Oclip and execute a command: - -Command -:: - oclip --product onap-honolulu pm-dictionary-validate --yaml - -For example -:: - vnfadmin@ddc559540515:/tmp$ oclip --product onap-honolulu pm-dictionary-validate --yaml /tmp/Simple_Valid_Schema.yaml - {"file":"/tmp/Simple_Valid_Schema.yaml","date":"Mon Dec 28 07:38:43 UTC 2020","criteria":"PASS","errors":"[]"} - - vnfadmin@ddc559540515:/tmp$ oclip --product onap-honolulu pm-dictionary-validate --yaml /tmp/PM_Dictionary.yaml - {"file":"/tmp/PM_Dictionary.yaml","date":"Mon Dec 28 07:38:08 UTC 2020","criteria":"FAILED","errors":" - [{\"yamlDocumentNumber\":1,\"path\":\"/pmMetaData/pmFields/measResultType\", - \"message\":\"Value(s) is/are not in array of accepted values.\\n value(s): integer\\n accepted value(s): - [float, uint32, uint64]\"},{\"yamlDocumentNumber\":1,\"path\":\"/pmMetaData/pmFields/\",\"message\":\"Key not found: measChangeType\"}, - {\"yamlDocumentNumber\":2,\"path\":\"/pmMetaData/pmFields/\",\"message\":\"Key not found: measChangeType\"}, - {\"yamlDocumentNumber\":3,\"path\":\"/pmMetaData/pmFields/measAdditionalFields/vendorField1\", - \"message\":\"Value(s) is/are not in array of accepted values.\\n value(s): [Z, A]\\n accepted value(s): [X, Y, Z]\"}]"} -- cgit 1.2.3-korg