From 4378d4320db7801625a1d55a261ac4c712c0e3fe Mon Sep 17 00:00:00 2001 From: Torben Deppe Date: Thu, 30 Apr 2020 17:12:43 +0200 Subject: [PATCH 1/6] compliance_tool: update readme --- aas/compliance_tool/cli.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/aas/compliance_tool/cli.py b/aas/compliance_tool/cli.py index c98c495..97752ad 100644 --- a/aas/compliance_tool/cli.py +++ b/aas/compliance_tool/cli.py @@ -30,13 +30,40 @@ def main(): parser = argparse.ArgumentParser( prog='compliance_tool', description='Compliance tool for creating and checking json and xml files in compliance with "Details of the ' - 'Asset Administration Shell" specification of Plattform Industrie 4.0.', + 'Asset Administration Shell" specification of Plattform Industrie 4.0. \n\n' + 'This tool has five features: \n' + '1. create a xml or json file with example aas elements\n' + '2. check a given xml or json file if it is compliance with the official json or xml aas schema\n' + '3. check if a given xml or json file is deserializable\n' + '4. check if the data in a given xml or json file is the same as the example data\n' + '5. check if two given xml or json files containing the same aas elements in any order\n\n' + 'For the use first the feature must be specified (create, schema, deserialization, example, files)' + ' or in short (c, s, d, e or f).\n' + 'Depending the chosen feature different arguments must be specified:\n' + 'create or c: path to the file which shall be created (file_1)\n' + 'schema or s: file which should be checked (file_1) and the path to the official aas ' + 'schema (-s or --schema)\n' + 'deserialization or d: file which should be checked (file_1)\n' + 'example or e: file which should be checked (file_1)\n' + 'files or f: file 1 which should be checked (file_1) and file 2 which should be checked ' + '(file_2)\n' + 'For all features it must be specified weather the given or created files are json (--json) or ' + 'xml (--xml).\n\n' + 'Additionally the tool offers some extra features for more convenient use:\n' + 'a. Different kind of displaying the information:\n' + ' Standard output is just the status for each step performed. With -v or --verbose additional ' + 'information in case of status = FAILED will be provided. With one more -v or --verbose additional' + ' information even in case of status = SUCCESS or WARNINGS will be provided.\n' + 'b. No Information output if successful:\n' + ' With -q or --quite no output will be generated if the status = SUCCESS.\n' + 'c. Save log additionally in a logfile:\n' + ' With -l or --logfile a path to the file where the logfiles shall be created can be specified.', formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('action', choices=['create', 'c', 'schema', 's', 'deserialization', 'd', 'example', 'e', 'files', 'f'], - help='c or create: creates a file with the example data with the given file path\n' - 's or schema: checks a given file if it is compliance with the official json schema\n' + help='c or create: creates a file with example data\n' + 's or schema: checks a given file if it is compliance with the official schema\n' 'd or deserialization: checks if a given file is deserializable\n' 'e or example: checks if a given file contains the example aas elements\n' 'f or files: checks if two given files contains the same aas elements in any order') -- GitLab From 6bac922cdf93bdc7e0e3b31dfa8897a16357a415 Mon Sep 17 00:00:00 2001 From: Torben Deppe Date: Fri, 15 May 2020 16:51:22 +0200 Subject: [PATCH 2/6] compliance_tool.cli: fixed review comments --- aas/compliance_tool/cli.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/aas/compliance_tool/cli.py b/aas/compliance_tool/cli.py index 97752ad..17c0166 100644 --- a/aas/compliance_tool/cli.py +++ b/aas/compliance_tool/cli.py @@ -32,26 +32,26 @@ def main(): description='Compliance tool for creating and checking json and xml files in compliance with "Details of the ' 'Asset Administration Shell" specification of Plattform Industrie 4.0. \n\n' 'This tool has five features: \n' - '1. create a xml or json file with example aas elements\n' - '2. check a given xml or json file if it is compliance with the official json or xml aas schema\n' + '1. create an xml or json file with example aas elements\n' + '2. check a given xml or json file if it is compliant with the official json or xml aas schema\n' '3. check if a given xml or json file is deserializable\n' '4. check if the data in a given xml or json file is the same as the example data\n' - '5. check if two given xml or json files containing the same aas elements in any order\n\n' + '5. check if two given xml or json files contain the same aas elements in any order\n\n' 'For the use first the feature must be specified (create, schema, deserialization, example, files)' ' or in short (c, s, d, e or f).\n' 'Depending the chosen feature different arguments must be specified:\n' 'create or c: path to the file which shall be created (file_1)\n' - 'schema or s: file which should be checked (file_1) and the path to the official aas ' + 'schema or s: file to be checked (file_1) and the path to the official aas ' 'schema (-s or --schema)\n' - 'deserialization or d: file which should be checked (file_1)\n' - 'example or e: file which should be checked (file_1)\n' + 'deserialization or d: file to be checked (file_1)\n' + 'example or e: file to be checked (file_1)\n' 'files or f: file 1 which should be checked (file_1) and file 2 which should be checked ' '(file_2)\n' 'For all features it must be specified weather the given or created files are json (--json) or ' 'xml (--xml).\n\n' 'Additionally the tool offers some extra features for more convenient use:\n' - 'a. Different kind of displaying the information:\n' - ' Standard output is just the status for each step performed. With -v or --verbose additional ' + 'a. Different levels of displaying information:\n' + ' Default output is just the status for each step performed. With -v or --verbose additional ' 'information in case of status = FAILED will be provided. With one more -v or --verbose additional' ' information even in case of status = SUCCESS or WARNINGS will be provided.\n' 'b. No Information output if successful:\n' @@ -66,14 +66,15 @@ def main(): 's or schema: checks a given file if it is compliance with the official schema\n' 'd or deserialization: checks if a given file is deserializable\n' 'e or example: checks if a given file contains the example aas elements\n' - 'f or files: checks if two given files contains the same aas elements in any order') + 'f or file_compare: checks if two given files contain the same aas elements in any order') parser.add_argument('file_1', help="path to file 1") parser.add_argument('file_2', nargs='?', default=None, help="path to file 2: is required if action f or files is " "choosen") parser.add_argument('-s', '--schema', help="path to the aas schema: is required if action s or schema is choosen.", default=None) - parser.add_argument('-v', '--verbose', help="display all information occurred while checking: 1: Error information," - " 2: Additional Success information", action='count', default=0) + parser.add_argument('-v', '--verbose', help="Print detailed information for each check. Multiple -v options " + "increase the verbosity. 1: Detailed error information, 2: Additional " + "detailed success information", action='count', default=0) parser.add_argument('-q', '--quite', help="no information output if successful", action='store_true') group = parser.add_mutually_exclusive_group(required=True) group.add_argument('--json', help="checking or creating json file(s)", action='store_true') -- GitLab From bdd98632d31403315484db36d686c7ae579bc6bc Mon Sep 17 00:00:00 2001 From: Torben Deppe Date: Fri, 15 May 2020 17:17:58 +0200 Subject: [PATCH 3/6] compliance_tool.cli: fix review comment --- aas/compliance_tool/cli.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aas/compliance_tool/cli.py b/aas/compliance_tool/cli.py index 17c0166..3a97bcc 100644 --- a/aas/compliance_tool/cli.py +++ b/aas/compliance_tool/cli.py @@ -45,8 +45,7 @@ def main(): 'schema (-s or --schema)\n' 'deserialization or d: file to be checked (file_1)\n' 'example or e: file to be checked (file_1)\n' - 'files or f: file 1 which should be checked (file_1) and file 2 which should be checked ' - '(file_2)\n' + 'file_compare or f: files to compare (file_1, file_2)\n' 'For all features it must be specified weather the given or created files are json (--json) or ' 'xml (--xml).\n\n' 'Additionally the tool offers some extra features for more convenient use:\n' -- GitLab From 7c321883f17903220dfa72809a641917a56421d2 Mon Sep 17 00:00:00 2001 From: Michael Thies Date: Mon, 18 May 2020 10:58:58 +0200 Subject: [PATCH 4/6] compliance_tool.cli: Improve language of help output --- aas/compliance_tool/cli.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/aas/compliance_tool/cli.py b/aas/compliance_tool/cli.py index 3a97bcc..8b2036d 100644 --- a/aas/compliance_tool/cli.py +++ b/aas/compliance_tool/cli.py @@ -37,26 +37,26 @@ def main(): '3. check if a given xml or json file is deserializable\n' '4. check if the data in a given xml or json file is the same as the example data\n' '5. check if two given xml or json files contain the same aas elements in any order\n\n' - 'For the use first the feature must be specified (create, schema, deserialization, example, files)' - ' or in short (c, s, d, e or f).\n' - 'Depending the chosen feature different arguments must be specified:\n' + 'As a first argument, the feature must be specified (create, schema, deserialization, example, ' + 'files) or in short (c, s, d, e or f).\n' + 'Depending the chosen feature, different additional arguments must be specified:\n' 'create or c: path to the file which shall be created (file_1)\n' 'schema or s: file to be checked (file_1) and the path to the official aas ' 'schema (-s or --schema)\n' 'deserialization or d: file to be checked (file_1)\n' 'example or e: file to be checked (file_1)\n' 'file_compare or f: files to compare (file_1, file_2)\n' - 'For all features it must be specified weather the given or created files are json (--json) or ' + 'In any case, it must be specified whether the (given or created) files are json (--json) or ' 'xml (--xml).\n\n' - 'Additionally the tool offers some extra features for more convenient use:\n' - 'a. Different levels of displaying information:\n' - ' Default output is just the status for each step performed. With -v or --verbose additional ' - 'information in case of status = FAILED will be provided. With one more -v or --verbose additional' + 'Additionally, the tool offers some extra features for more convenient usage:\n' + 'a. Different levels of verbosity:\n' + ' Default output is just the status for each step performed. With -v or --verbose, additional ' + 'information in case of status = FAILED will be provided. With one more -v or --verbose, additional' ' information even in case of status = SUCCESS or WARNINGS will be provided.\n' - 'b. No Information output if successful:\n' + 'b. Suppressing output on success:\n' ' With -q or --quite no output will be generated if the status = SUCCESS.\n' 'c. Save log additionally in a logfile:\n' - ' With -l or --logfile a path to the file where the logfiles shall be created can be specified.', + ' With -l or --logfile, a path to the file where the logfiles shall be created can be specified.', formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('action', choices=['create', 'c', 'schema', 's', 'deserialization', 'd', 'example', 'e', @@ -69,16 +69,17 @@ def main(): parser.add_argument('file_1', help="path to file 1") parser.add_argument('file_2', nargs='?', default=None, help="path to file 2: is required if action f or files is " "choosen") - parser.add_argument('-s', '--schema', help="path to the aas schema: is required if action s or schema is choosen.", + parser.add_argument('-s', '--schema', help="path to the AAS xml/json schema file. Required, if action 's' or " + "'schema' is choosen.", default=None) parser.add_argument('-v', '--verbose', help="Print detailed information for each check. Multiple -v options " "increase the verbosity. 1: Detailed error information, 2: Additional " "detailed success information", action='count', default=0) parser.add_argument('-q', '--quite', help="no information output if successful", action='store_true') group = parser.add_mutually_exclusive_group(required=True) - group.add_argument('--json', help="checking or creating json file(s)", action='store_true') - group.add_argument('--xml', help="checking or creating xml file(s)", action='store_true') - parser.add_argument('-l', '--logfile', help="creates the log additional in the given file", default=None) + group.add_argument('--json', help="Use AAS json format when checking or creating files", action='store_true') + group.add_argument('--xml', help="Use AAS xml format when checking or creating files", action='store_true') + parser.add_argument('-l', '--logfile', help="Log file to be created in addition to output to stdout", default=None) args = parser.parse_args() -- GitLab From 8908849bc77738a57aac629fc2a9a4f0b2909b7b Mon Sep 17 00:00:00 2001 From: Torben Deppe Date: Mon, 18 May 2020 12:10:19 +0200 Subject: [PATCH 5/6] Readme: Add section about Compliance Tool --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 2094113..f439f54 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,18 @@ administration shells, submodels and assets * `examples.tutorial_storage`: Tutorial for storing asset administration shells, submodels and assets +### Compliance Tool + +A compliance tool for testing xml and json files is provided in the `aas.compliance_tool`-package. Following +functionalities are supported: + +* create an xml or json file compliant to the official schema containing example Asset Administration Shell elements +* check if a given xml or json file is compliant to the official schema +* check if a given xml or json file is deserializable even if it is not compliant to the offical schema +* check if the data in a given xml or json file is the same as the example data +* check if two given xml or json file contain the same Asset Administration Shell elements in any order + + ## Contributing If you plan contributing code to the PyI40AAS project, please get in touch with us via E-Mail first: m.thies@plt.rwth-aachen.de -- GitLab From dc4011aeb48107f0202f4ef107253db2f144b9ed Mon Sep 17 00:00:00 2001 From: Torben Deppe Date: Tue, 19 May 2020 12:24:49 +0200 Subject: [PATCH 6/6] README: add usage information of compliance tool --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f439f54..10d65d3 100644 --- a/README.md +++ b/README.md @@ -109,8 +109,8 @@ administration shells, submodels and assets ### Compliance Tool -A compliance tool for testing xml and json files is provided in the `aas.compliance_tool`-package. Following -functionalities are supported: +The PyI40AAS project contains a compliance tool for testing xml and json files is provided in the +`aas.compliance_tool`-package. Following functionalities are supported: * create an xml or json file compliant to the official schema containing example Asset Administration Shell elements * check if a given xml or json file is compliant to the official schema @@ -118,6 +118,11 @@ functionalities are supported: * check if the data in a given xml or json file is the same as the example data * check if two given xml or json file contain the same Asset Administration Shell elements in any order +Invoking should work with either `python -m aas.compliance_tool.cli` or (when installed correctly and PATH is set +correctly) with `aas_compliance_check` on the command line. + +For further usage information consider the `aas.compliance_tool`-package or invoke with +`python -m aas.compliance_tool.cli --help` respectively `aas_compliance_check --help`. ## Contributing -- GitLab